Interface StreamProvider

  • All Superinterfaces:
    java.lang.AutoCloseable, java.io.Closeable
    All Known Implementing Classes:
    BeamStreamProvider, BeamStreamProvider.Default

    public interface StreamProvider
    extends java.io.Closeable
    Provider of Stream based on various parameters.
    • Method Detail

      • init

        default void init​(Repository repo,
                          java.lang.String[] args)
        Initialize the provider with given repository.
        Parameters:
        repo - the repository
        args - command line arguments passed to Console
      • close

        void close()
        Close and release all resources.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
      • getStream

        Stream<StreamElement> getStream​(Position position,
                                        boolean stopAtCurrent,
                                        boolean eventTime,
                                        StreamProvider.TerminatePredicate terminateCheck,
                                        AttributeDescriptor<?>... attrs)
        Create stream from commit log(s).
        Parameters:
        position - position in commit log
        stopAtCurrent - true to stop at current data
        eventTime - true to process using event time
        terminateCheck - Predicate that tests if the execution of any terminal operation should be interrupted
        attrs - attributes to get stream for
        Returns:
        stream from commit log
      • getBatchUpdates

        WindowedStream<StreamElement> getBatchUpdates​(long startStamp,
                                                      long endStamp,
                                                      StreamProvider.TerminatePredicate terminateCheck,
                                                      AttributeDescriptor<?>... attrs)
        Retrieve batch updates stream.
        Parameters:
        startStamp - starting stamp (inclusive)
        endStamp - ending stamp (exclusive)
        terminateCheck - Predicate that tests if the execution of any terminal operation should be interrupted
        attrs - attributes to read
        Returns:
        globally windowed stream
      • getBatchSnapshot

        WindowedStream<StreamElement> getBatchSnapshot​(long fromStamp,
                                                       long toStamp,
                                                       StreamProvider.TerminatePredicate terminateCheck,
                                                       AttributeDescriptor<?>... attrs)
        Retrieve batch snapshot stream.
        Parameters:
        fromStamp - starting stamp (inclusive)
        toStamp - ending stamp (exclusive)
        terminateCheck - Predicate that tests if the execution of any terminal operation should be interrupted
        attrs - attributes to read
        Returns:
        globally windowed stream
      • impulse

        default <T> WindowedStream<T> impulse​(groovy.lang.Closure<T> factory)
        Return new WindowedStream that contains single element generated by calling given (parameterless) Closure.
        Type Parameters:
        T - type of the resulting stream
        Parameters:
        factory - the closure that generates the element
        Returns:
        globally windowed stream with single element
      • impulse

        <T> WindowedStream<T> impulse​(@Nullable
                                      java.lang.String name,
                                      groovy.lang.Closure<T> factory)
        Return new WindowedStream that contains single element generated by calling given (parameterless) Closure.
        Type Parameters:
        T - type of the resulting stream
        Parameters:
        name - name of the transform
        factory - the closure that generates the element
        Returns:
        globally windowed stream with single element
      • periodicImpulse

        default <T> WindowedStream<T> periodicImpulse​(groovy.lang.Closure<T> factory,
                                                      long durationMs)
        Create new WindowedStream that contains single element per fixed time windowed.
        Type Parameters:
        T - type of the resulting stream
        Parameters:
        factory - the closure that generates the element
        durationMs - duration of the fixed time window in ms
        Returns:
        globally windowed stream with single element
      • periodicImpulse

        <T> WindowedStream<T> periodicImpulse​(@Nullable
                                              java.lang.String name,
                                              groovy.lang.Closure<T> factory,
                                              long durationMs)
        Create new WindowedStream that contains single element per fixed time windowed.
        Type Parameters:
        T - type of the resulting stream
        Parameters:
        name - name of the transform
        factory - the closure that generates the element
        durationMs - duration of the fixed time window in ms
        Returns:
        globally windowed stream with single element