T
- The type of events being sent through this stream.public interface EventStreamReader<T> extends AutoCloseable
This class is safe to use across threads, but doing so will not increase performance.
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the reader.
|
ReaderConfig |
getConfig()
Gets the configuration that this reader was created with.
|
T |
read(EventPointer pointer)
Re-read an event that was previously read, by passing the pointer returned from
EventRead.getEventPointer() . |
EventRead<T> |
readNextEvent(long timeout)
Gets the next event in the stream.
|
EventRead<T> readNextEvent(long timeout) throws ReinitializationRequiredException
EventRead.getEvent()
. (As well as for most other fields)timeout
- An upper bound on how long the call may block before returning null.EventRead
, which contains the next event in the stream. In the case the timeout
is reached, EventRead.getEvent()
returns null.ReinitializationRequiredException
- Is throw in the event that
ReaderGroup.resetReadersToCheckpoint(Checkpoint)
or
ReaderGroup.updateConfig(ReaderGroupConfig, java.util.Set)
was called
which requires readers to be reinitialized.ReaderConfig getConfig()
T read(EventPointer pointer) throws io.pravega.client.segment.impl.NoSuchEventException
EventRead.getEventPointer()
.
This does not affect the current position of the reader.
This is a blocking call. Passing invalid offsets has undefined behavior.
pointer
- The pointer object to enable a random read of the event.io.pravega.client.segment.impl.NoSuchEventException
- Reader was not able to fetch the event.void close()
ReaderGroup.readerOffline(String, Position)
close
in interface AutoCloseable
AutoCloseable.close()