Class BeamStreamProvider

    • Constructor Detail

      • BeamStreamProvider

        public BeamStreamProvider()
    • Method Detail

      • wrap

        public static <T> Stream<T> wrap​(Repository repo,
                                         org.apache.beam.sdk.values.PCollection<T> pCollection)
        Create a Stream from given PCollection.
        Parameters:
        repo - Repository to use
        pCollection - the PCollection to wrap
        Returns:
        PCollection wrapped as Stream.
      • init

        public void init​(Repository repo,
                         java.lang.String[] args)
        Description copied from interface: StreamProvider
        Initialize the provider with given repository.
        Specified by:
        init in interface StreamProvider
        Parameters:
        repo - the repository
        args - command line arguments passed to Console
      • getStream

        public Stream<StreamElement> getStream​(Position position,
                                               boolean stopAtCurrent,
                                               boolean eventTime,
                                               StreamProvider.TerminatePredicate terminateCheck,
                                               AttributeDescriptor<?>... attrs)
        Description copied from interface: StreamProvider
        Create stream from commit log(s).
        Specified by:
        getStream in interface StreamProvider
        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
      • impulse

        public <T> WindowedStream<T> impulse​(java.lang.String name,
                                             groovy.lang.Closure<T> factory)
        Description copied from interface: StreamProvider
        Return new WindowedStream that contains single element generated by calling given (parameterless) Closure.
        Specified by:
        impulse in interface StreamProvider
        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

        public <T> WindowedStream<T> periodicImpulse​(java.lang.String name,
                                                     groovy.lang.Closure<T> factory,
                                                     long durationMs)
        Description copied from interface: StreamProvider
        Create new WindowedStream that contains single element per fixed time windowed.
        Specified by:
        periodicImpulse in interface StreamProvider
        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
      • close

        public void close()
        Description copied from interface: StreamProvider
        Close and release all resources.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface StreamProvider
      • getPipelineOptionsFactory

        protected java.util.function.Supplier<org.apache.beam.sdk.options.PipelineOptions> getPipelineOptionsFactory()
        Create factory to be used for pipeline creation.
        Returns:
        the factory
      • getCreatePipelineFromOpts

        protected UnaryFunction<org.apache.beam.sdk.options.PipelineOptions,​org.apache.beam.sdk.Pipeline> getCreatePipelineFromOpts()
        Convert PipelineOptions into Pipeline.
        Returns:
        function to use for creating pipeline from options