Interface PersistentStreamSegment
-
- All Superinterfaces:
AutoCloseable,ResultStream<PersistentStreamEvent>
- All Known Implementing Classes:
BufferedPersistentStreamSegment
public interface PersistentStreamSegment extends ResultStream<PersistentStreamEvent>
An event stream producing events for one segment of a persistent stream.- Since:
- 2024.0.0
- Author:
- Marc Gathier
-
-
Field Summary
Fields Modifier and Type Field Description static longPENDING_WORK_DONE_MARKERAcknowledgement value to indicate that all events processed after a segment is closed
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidacknowledge(long token)Sends the last processed token for this segment to Axon Server.voiderror(String error)voidonSegmentClosed(Runnable callback)Registers a callback that will be invoked when Axon Server closes the segment within the persistent stream connection.intsegment()Returns the segment number of the stream.-
Methods inherited from interface io.axoniq.axonserver.connector.ResultStream
close, getError, isClosed, next, nextIfAvailable, nextIfAvailable, onAvailable, peek
-
-
-
-
Field Detail
-
PENDING_WORK_DONE_MARKER
static final long PENDING_WORK_DONE_MARKER
Acknowledgement value to indicate that all events processed after a segment is closed- See Also:
- Constant Field Values
-
-
Method Detail
-
onSegmentClosed
void onSegmentClosed(Runnable callback)
Registers a callback that will be invoked when Axon Server closes the segment within the persistent stream connection. This happens when the number of segments in the persistent stream has changed or when Axon Server assigns a segment to another client.- Parameters:
callback- the callback to register
-
acknowledge
void acknowledge(long token)
Sends the last processed token for this segment to Axon Server. Clients may choose to notify each processed event, or to only sent progress information after a number of processed events.- Parameters:
token- the last processed token for this segment
-
error
void error(String error)
-
segment
int segment()
Returns the segment number of the stream.- Returns:
- the segment number of this stream
-
-