Class IteratorBackedDomainEventStream
java.lang.Object
org.axonframework.eventsourcing.eventstore.IteratorBackedDomainEventStream
- All Implemented Interfaces:
Iterator<DomainEventMessage<?>>,DomainEventStream
DomainEventStream implementation that gets its messages from an Iterator.
- Since:
- 3.0.3
-
Constructor Summary
ConstructorsConstructorDescriptionIteratorBackedDomainEventStream(Iterator<? extends DomainEventMessage<?>> iterator) Initialize the stream which provides access to message from the giveniterator -
Method Summary
Modifier and TypeMethodDescriptionGet the highest known sequence number in the upstream event entry stream.booleanhasNext()Returnstrueif the stream has more events, meaning that a call tonext()will not result in an exception.next()Returns the next events in the stream, if available.peek()Returns the next events in the stream, if available, without moving the pointer forward.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.axonframework.eventsourcing.eventstore.DomainEventStream
asStream, filter, removeMethods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
IteratorBackedDomainEventStream
Initialize the stream which provides access to message from the giveniterator- Parameters:
iterator- The iterator providing the messages to stream
-
-
Method Details
-
peek
Description copied from interface:DomainEventStreamReturns the next events in the stream, if available, without moving the pointer forward. Hence, a call toDomainEventStream.next()will return the same event as a call topeek(). UsehasNext()to obtain a guarantee about the availability of any next event. If the pointer has reached the end of the stream, the behavior of this method is undefined. It could either returnnull, or throw an exception, depending on the actual implementation. UseDomainEventStream.hasNext()to confirm the existence of elements after the current pointer.- Specified by:
peekin interfaceDomainEventStream- Returns:
- the next event in the stream.
-
hasNext
public boolean hasNext()Description copied from interface:DomainEventStreamReturnstrueif the stream has more events, meaning that a call tonext()will not result in an exception. If a call to this method returnsfalse, there is no guarantee about the result of a consecutive call tonext()- Specified by:
hasNextin interfaceDomainEventStream- Specified by:
hasNextin interfaceIterator<DomainEventMessage<?>>- Returns:
trueif the stream contains more events.
-
next
Description copied from interface:DomainEventStreamReturns the next events in the stream, if available. UsehasNext()to obtain a guarantee about the availability of any next event. Each call tonext()will forward the pointer to the next event in the stream. If the pointer has reached the end of the stream, the behavior of this method is undefined. It could either returnnull, or throw an exception, depending on the actual implementation. UseDomainEventStream.hasNext()to confirm the existence of elements after the current pointer.- Specified by:
nextin interfaceDomainEventStream- Specified by:
nextin interfaceIterator<DomainEventMessage<?>>- Returns:
- the next event in the stream.
-
getLastSequenceNumber
Description copied from interface:DomainEventStreamGet the highest known sequence number in the upstream event entry stream. Note that, as result of upcasting it is possible that the last event in this stream has a lower sequence number than that returned by this method.To get the highest absolute sequence number of the underlying event entry stream make sure to iterate over all elements in the stream before calling this method.
If the stream is empty this method returns
null.- Specified by:
getLastSequenceNumberin interfaceDomainEventStream- Returns:
- the sequence number of the last known upstream event entry
-