Interface BatchClientFactory

  • All Superinterfaces:
    java.lang.AutoCloseable

    @Beta
    public interface BatchClientFactory
    extends java.lang.AutoCloseable
    Please note this is an experimental API. Used to get metadata about and read from an existing streams. All events written to a stream will be visible to SegmentIterators Events within a segment are strictly ordered, but as this API allows for reading from multiple segments in parallel without adhering to time ordering. This allows for even greater parallelization at the expense of the ordering guarantees provided by EventStreamReader.
    • Method Detail

      • withScope

        static BatchClientFactory withScope​(java.lang.String scope,
                                            ClientConfig config)
        Creates a new instance of BatchClientFactory.
        Parameters:
        scope - The scope of the stream.
        config - Configuration for the client.
        Returns:
        Instance of BatchClientFactory implementation.
      • getSegments

        StreamSegmentsIterator getSegments​(Stream stream,
                                           StreamCut fromStreamCut,
                                           StreamCut toStreamCut)
        Provides a list of segments for a given stream between fromStreamCut and toStreamCut. Passing StreamCut.UNBOUNDED or null to fromStreamCut and toStreamCut will result in using the current start of stream and the current end of stream respectively. Note: In case of stream truncation:

        - Passing a null to fromStreamCut will result in using the current start of the Stream post truncation.

        - Passing a fromStreamCut which points to the truncated stream will result in a NoSuchSegmentException while iterating over SegmentRange iterator obtained via StreamSegmentsIterator.getIterator()

        Parameters:
        stream - the stream.
        fromStreamCut - starting stream cut.
        toStreamCut - end stream cut.
        Returns:
        Segment information between the two stream cuts.
      • readSegment

        <T> SegmentIterator<T> readSegment​(SegmentRange segment,
                                           Serializer<T> deserializer)
        Provides a SegmentIterator to read the events in the requested segment starting from the beginning of the segment and ending at the current end of the segment.
        Type Parameters:
        T - The type of events written to the segment.
        Parameters:
        segment - The segment to read from
        deserializer - A deserializer to be used to parse events
        Returns:
        A SegmentIterator over the requested segment
      • close

        void close()
        Closes the client factory. This will close any connections created through it.
        Specified by:
        close in interface java.lang.AutoCloseable
        See Also:
        AutoCloseable.close()