Interface EventStreamReader<T>

  • Type Parameters:
    T - The type of events being sent through this stream.
    All Superinterfaces:
    java.lang.AutoCloseable

    public interface EventStreamReader<T>
    extends java.lang.AutoCloseable
    A reader for a stream.

    This class is safe to use across threads, but doing so will not increase performance.

    • Method Detail

      • getCurrentTimeWindow

        TimeWindow getCurrentTimeWindow​(Stream stream)
        Returns a window which represents the range of time that this reader is currently reading as provided by writers via the EventStreamWriter.noteTime(long) API. If no writers were providing timestamps at the current position in the stream `null` will be returned.
        Parameters:
        stream - the stream to obtain a time window for.
        Returns:
        A TimeWindow which bounds the current location in the stream, or null if one cannot be established.
      • getConfig

        ReaderConfig getConfig()
        Gets the configuration that this reader was created with.
        Returns:
        Reader configuration
      • fetchEvent

        T fetchEvent​(EventPointer pointer)
              throws io.pravega.client.segment.impl.NoSuchEventException
        Re-read an event that was previously read, by passing the pointer returned from EventRead.getEventPointer(). This does not affect the current position of the reader.

        This is a blocking call. Passing invalid offsets has undefined behavior.

        Parameters:
        pointer - The pointer object to enable a random read of the event.
        Returns:
        The event at the position specified by the provided pointer or null if the event has been deleted.
        Throws:
        io.pravega.client.segment.impl.NoSuchEventException - Reader was not able to fetch the event.
      • close

        void close()
        Close the reader. No further actions may be performed. If this reader is part of a reader group, this will automatically invoke ReaderGroup.readerOffline(String, Position)
        Specified by:
        close in interface java.lang.AutoCloseable
        See Also:
        AutoCloseable.close()