public class BufferedAggregateEventStream extends FlowControlledBuffer<Event,GetAggregateEventsRequest> implements AggregateEventStream
AggregateEventStream used for Event Sourced Aggregates.| Constructor and Description |
|---|
BufferedAggregateEventStream()
|
BufferedAggregateEventStream(int bufferSize,
int refillBatch)
Constructs a
BufferedAggregateEventStream with the given bufferSize. |
| Modifier and Type | Method and Description |
|---|---|
protected GetAggregateEventsRequest |
buildFlowControlMessage(FlowControl flowControl)
Build a flow control message of type
OUT based on the given flowControl. |
void |
cancel()
Close this stream for further reading, notifying the provider of Events to stop streaming them.
|
boolean |
hasNext()
Indicates whether a new event is available.
|
Event |
next()
Returns the next available event, possibly blocking until one becomes available for reading.
|
protected Event |
terminalMessage()
Builds a terminal message of type
T specifying when the this stream is closed. |
beforeStart, close, getErrorResult, isClosed, onCompleted, onError, onNext, peek, take, tryTake, tryTake, tryTake, tryTakeNowbuildInitialFlowControlMessage, enableFlowControl, markConsumed, outboundStreamclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitasStreampublic BufferedAggregateEventStream()
public BufferedAggregateEventStream(int bufferSize,
int refillBatch)
BufferedAggregateEventStream with the given bufferSize.bufferSize - the buffer size of the aggregate event streampublic Event next() throws InterruptedException
AggregateEventStreamnext in interface AggregateEventStreamInterruptedException - if the current thread was interrupted while waiting for an event to become
availableto verify availability of eventspublic boolean hasNext()
AggregateEventStreamhasNext in interface AggregateEventStreamtrue if a message is available, or false if the stream has reached the endpublic void cancel()
AggregateEventStream
Note that after calling cancel, AggregateEventStream.hasNext() may throw a StreamClosedException if the
cancellation caused the stream to close before the last message was received.
cancel in interface AggregateEventStreamprotected GetAggregateEventsRequest buildFlowControlMessage(FlowControl flowControl)
FlowControlledStreamOUT based on the given flowControl.buildFlowControlMessage in class FlowControlledStream<Event,GetAggregateEventsRequest>flowControl - the FlowControl message used to base this implementation's flow control message onINprotected Event terminalMessage()
FlowControlledBufferT specifying when the this stream is closed.terminalMessage in class FlowControlledBuffer<Event,GetAggregateEventsRequest>T specifying when the this stream is closedCopyright © 2020–2022 AxonIQ BV. All rights reserved.