Package io.pravega.client.stream
Interface EventRead<T>
-
- Type Parameters:
T
- The type of the event.
public interface EventRead<T>
An event that was read from a stream or a checkpoint marker if one has been requested.A checkpoint is an indication that the reading application should persist its state to durable storage before reading further. A checkpoint also represents a point where events waiting to be read may be rebalanced among the readers in a group. So before a checkpoint one reader might be handling all of the events sent with routing key X but afterwards it may be a different reader.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String
getCheckpointName()
If a checkpoint has been requested this will return the checkpointName passed toReaderGroup.initiateCheckpoint(String,ScheduledExecutorService)
otherwise this will return null.T
getEvent()
Returns the event that is wrapped in this EventRead or null a timeout occurred or if a checkpoint was requested.EventPointer
getEventPointer()
Returns a pointer object for the event read.Position
getPosition()
The position in the stream that represents where the reader is immediately following this event.boolean
isCheckpoint()
A boolean indicating if this is a checkpoint.boolean
isReadCompleted()
A boolean indicating if all events in the stream read completely.
-
-
-
Method Detail
-
getEvent
T getEvent()
Returns the event that is wrapped in this EventRead or null a timeout occurred or if a checkpoint was requested.- Returns:
- The event itself.
-
getPosition
Position getPosition()
The position in the stream that represents where the reader is immediately following this event. It is useful to store this so thatReaderGroup.readerOffline(String, Position)
can be called if the reader dies.- Returns:
- Position of the event
-
getEventPointer
EventPointer getEventPointer()
Returns a pointer object for the event read. The event pointer enables a random read of the event at a future time.- Returns:
- Pointer to an event
-
isCheckpoint
boolean isCheckpoint()
A boolean indicating if this is a checkpoint. In which casegetCheckpointName()
will be non-null andgetEvent()
will be null.- Returns:
- true if this is a checkpoint.
-
isReadCompleted
boolean isReadCompleted()
A boolean indicating if all events in the stream read completely. This is true when the streams are sealed and all events in the streams have already been read.- Returns:
- true if all events in the stream read completely.
-
getCheckpointName
java.lang.String getCheckpointName()
If a checkpoint has been requested this will return the checkpointName passed toReaderGroup.initiateCheckpoint(String,ScheduledExecutorService)
otherwise this will return null.- Returns:
- The name of the checkpoint
-
-