Interface FlowOpsMat<Out,​Mat>

  • All Superinterfaces:
    FlowOps<Out,​Mat>
    All Known Implementing Classes:
    Flow, Source

    public interface FlowOpsMat<Out,​Mat>
    extends FlowOps<Out,​Mat>
    INTERNAL API: this trait will be changed in binary-incompatible ways for classes that are derived from it! Do not implement this interface outside the Akka code base!

    Binary compatibility is only maintained for callers of this trait&rsquo;s interface.

    • Method Detail

      • concatLazyMat

        <U,​Mat2,​Mat3> FlowOpsMat concatLazyMat​(Graph<SourceShape<U>,​Mat2> that,
                                                           scala.Function2<Mat,​Mat2,​Mat3> matF)
        Concatenate the given Source to this Flow, meaning that once this Flow&rsquo;s input is exhausted and all result elements have been generated, the Source&rsquo;s elements will be produced.

        Note that the Source is materialized together with this Flow, if lazy materialization is what is needed the operator can be combined with Source.lazy to defer materialization of that.

        The second source is then kept from producing elements by asserting back-pressure until its time comes.

        For a concat operator that is detached, use concatMat(akka.stream.Graph<akka.stream.SourceShape<U>, Mat2>, scala.Function2<Mat, Mat2, Mat3>)

      • concatMat

        <U,​Mat2,​Mat3> FlowOpsMat concatMat​(Graph<SourceShape<U>,​Mat2> that,
                                                       scala.Function2<Mat,​Mat2,​Mat3> matF)
        Concatenate the given Source to this Flow, meaning that once this Flow&rsquo;s input is exhausted and all result elements have been generated, the Source&rsquo;s elements will be produced.

        Note that the Source is materialized together with this Flow and is "detached" meaning it will in effect behave as a one element buffer in front of both the sources, that eagerly demands an element on start (so it can not be combined with Source.lazy to defer materialization of that).

        The second source is then kept from producing elements by asserting back-pressure until its time comes.

        When needing a concat operator that is not detached use concatLazyMat(akka.stream.Graph<akka.stream.SourceShape<U>, Mat2>, scala.Function2<Mat, Mat2, Mat3>)

      • interleaveMat

        <U,​Mat2,​Mat3> FlowOpsMat interleaveMat​(Graph<SourceShape<U>,​Mat2> that,
                                                           int segmentSize,
                                                           scala.Function2<Mat,​Mat2,​Mat3> matF)
        Interleave is a deterministic merge of the given Source with elements of this Flow. It first emits segmentSize number of elements from this flow to downstream, then - same amount for that source, then repeat process.

        After one of upstreams is complete then all the rest elements will be emitted from the second one

        If it gets error from one of upstreams - stream completes with failure.

      • interleaveMat

        <U,​Mat2,​Mat3> FlowOpsMat interleaveMat​(Graph<SourceShape<U>,​Mat2> that,
                                                           int segmentSize,
                                                           boolean eagerClose,
                                                           scala.Function2<Mat,​Mat2,​Mat3> matF)
        Interleave is a deterministic merge of the given Source with elements of this Flow. It first emits segmentSize number of elements from this flow to downstream, then - same amount for that source, then repeat process.

        If eagerClose is false and one of the upstreams complete the elements from the other upstream will continue passing through the interleave operator. If eagerClose is true and one of the upstream complete interleave will cancel the other upstream and complete itself.

        If it gets error from one of upstreams - stream completes with failure.

      • mapMaterializedValue

        <Mat2> FlowOpsMat mapMaterializedValue​(scala.Function1<Mat,​Mat2> f)
        Transform the materialized value of this graph, leaving all other properties as they were.
      • mergeLatestMat

        <U,​Mat2,​Mat3> FlowOpsMat mergeLatestMat​(Graph<SourceShape<U>,​Mat2> that,
                                                            boolean eagerClose,
                                                            scala.Function2<Mat,​Mat2,​Mat3> matF)
        MergeLatest joins elements from N input streams into stream of lists of size N. i-th element in list is the latest emitted element from i-th input stream. MergeLatest emits list for each element emitted from some input stream, but only after each input stream emitted at least one element.

      • mergeMat

        <U,​Mat2,​Mat3> FlowOpsMat mergeMat​(Graph<SourceShape<U>,​Mat2> that,
                                                      boolean eagerComplete,
                                                      scala.Function2<Mat,​Mat2,​Mat3> matF)
        Merge the given Source to this Flow, taking elements as they arrive from input streams, picking randomly when several elements ready.

      • mergeMat$default$2

        <U,​Mat2,​Mat3> boolean mergeMat$default$2()
      • mergePrioritizedMat

        <U,​Mat2,​Mat3> FlowOpsMat mergePrioritizedMat​(Graph<SourceShape<U>,​Mat2> that,
                                                                 int leftPriority,
                                                                 int rightPriority,
                                                                 boolean eagerClose,
                                                                 scala.Function2<Mat,​Mat2,​Mat3> matF)
        Merge two sources. Prefer the sources depending on the 'priority' parameters.

        It is recommended to use the internally optimized Keep.left and Keep.right combiners where appropriate instead of manually writing functions that pass through one of the values.

      • mergeSortedMat

        <U,​Mat2,​Mat3> FlowOpsMat mergeSortedMat​(Graph<SourceShape<U>,​Mat2> that,
                                                            scala.Function2<Mat,​Mat2,​Mat3> matF,
                                                            scala.math.Ordering<U> ord)
        Merge the given Source to this Flow, taking elements as they arrive from input streams, picking always the smallest of the available elements (waiting for one element from each side to be available). This means that possible contiguity of the input streams is not exploited to avoid waiting for elements, this merge will block when one of the inputs does not have more elements (and does not complete).

      • monitor

        <Mat2> FlowOpsMat monitor​(scala.Function2<Mat,​FlowMonitor<Out>,​Mat2> combine)
        Deprecated.
        Use monitor() or monitorMat(combine) instead. Since 2.5.17.
        Materializes to FlowMonitor[Out] that allows monitoring of the current flow. All events are propagated by the monitor unchanged. Note that the monitor inserts a memory barrier every time it processes an event, and may therefor affect performance.

        The combine function is used to combine the FlowMonitor with this flow's materialized value.

      • monitor

        FlowOpsMat monitor()
        Materializes to (Mat, FlowMonitor[Out]), which is unlike most other operators (!), in which usually the default materialized value keeping semantics is to keep the left value (by passing Keep.left() to a *Mat version of a method). This operator is an exception from that rule and keeps both values since dropping its sole purpose is to introduce that materialized value.

        The FlowMonitor[Out] allows monitoring of the current flow. All events are propagated by the monitor unchanged. Note that the monitor inserts a memory barrier every time it processes an event, and may therefor affect performance.

      • monitorMat

        <Mat2> FlowOpsMat monitorMat​(scala.Function2<Mat,​FlowMonitor<Out>,​Mat2> combine)
        Materializes to FlowMonitor[Out] that allows monitoring of the current flow. All events are propagated by the monitor unchanged. Note that the monitor inserts a memory barrier every time it processes an event, and may therefor affect performance.

        The combine function is used to combine the FlowMonitor with this flow's materialized value.

      • orElseMat

        <U,​Mat2,​Mat3> FlowOpsMat orElseMat​(Graph<SourceShape<U>,​Mat2> secondary,
                                                       scala.Function2<Mat,​Mat2,​Mat3> matF)
        Provides a secondary source that will be consumed if this stream completes without any elements passing by. As soon as the first element comes through this stream, the alternative will be cancelled.

        Note that this Flow will be materialized together with the Source and just kept from producing elements by asserting back-pressure until its time comes or it gets cancelled.

        On errors the operator is failed regardless of source of the error.

        '''Emits when''' element is available from first stream or first stream closed without emitting any elements and an element is available from the second stream

        '''Backpressures when''' downstream backpressures

        '''Completes when''' the primary stream completes after emitting at least one element, when the primary stream completes without emitting and the secondary stream already has completed or when the secondary stream completes

        '''Cancels when''' downstream cancels and additionally the alternative is cancelled as soon as an element passes by from this stream.

      • prependLazyMat

        <U,​Mat2,​Mat3> FlowOpsMat prependLazyMat​(Graph<SourceShape<U>,​Mat2> that,
                                                            scala.Function2<Mat,​Mat2,​Mat3> matF)
        Prepend the given Source to this Flow, meaning that before elements are generated from this Flow, the Source's elements will be produced until it is exhausted, at which point Flow elements will start being produced.

        Note that the Source is materialized together with this Flow and is "detached" meaning in effect behave as a one element buffer in front of both the sources, that eagerly demands an element on start (so it can not be combined with Source.lazy to defer materialization of that).

        This flow will then be kept from producing elements by asserting back-pressure until its time comes.

        When needing a prepend operator that is not detached use prependLazyMat(akka.stream.Graph<akka.stream.SourceShape<U>, Mat2>, scala.Function2<Mat, Mat2, Mat3>)

      • toMat

        <Mat2,​Mat3> Graph toMat​(Graph<SinkShape<Out>,​Mat2> sink,
                                      scala.Function2<Mat,​Mat2,​Mat3> combine)
        Connect this Flow to a Sink, concatenating the processing steps of both.
        
             +----------------------------+
             | Resulting Sink             |
             |                            |
             |  +------+        +------+  |
             |  |      |        |      |  |
         In ~~> | flow | ~Out~> | sink |  |
             |  |      |        |      |  |
             |  +------+        +------+  |
             +----------------------------+
         
        The combine function is used to compose the materialized values of this flow and that Sink into the materialized value of the resulting Sink.

        It is recommended to use the internally optimized Keep.left and Keep.right combiners where appropriate instead of manually writing functions that pass through one of the values.

      • viaMat

        <T,​Mat2,​Mat3> FlowOpsMat viaMat​(Graph<FlowShape<Out,​T>,​Mat2> flow,
                                                    scala.Function2<Mat,​Mat2,​Mat3> combine)
        Transform this Flow by appending the given processing steps.
        
             +---------------------------------+
             | Resulting Flow[In, T, M2]       |
             |                                 |
             |  +------+            +------+   |
             |  |      |            |      |   |
         In ~~> | this |  ~~Out~~>  | flow |  ~~> T
             |  |   Mat|            |     M|   |
             |  +------+            +------+   |
             +---------------------------------+
         
        The combine function is used to compose the materialized values of this flow and that flow into the materialized value of the resulting Flow.

        It is recommended to use the internally optimized Keep.left and Keep.right combiners where appropriate instead of manually writing functions that pass through one of the values.

      • watchTermination

        <Mat2> FlowOpsMat watchTermination​(scala.Function2<Mat,​scala.concurrent.Future<Done>,​Mat2> matF)
        Materializes to Future[Done] that completes on getting termination message. The Future completes with success when received complete message from upstream or cancel from downstream. It fails with the propagated error when received error message from upstream or downstream.

        It is recommended to use the internally optimized Keep.left and Keep.right combiners where appropriate instead of manually writing functions that pass through one of the values.

      • zipLatestMat

        <U,​Mat2,​Mat3> FlowOpsMat zipLatestMat​(Graph<SourceShape<U>,​Mat2> that,
                                                          scala.Function2<Mat,​Mat2,​Mat3> matF)
        Combine the elements of current flow and the given Source into a stream of tuples, picking always the latest of the elements of each source.

      • zipLatestWithMat

        <Out2,​Out3,​Mat2,​Mat3> FlowOpsMat zipLatestWithMat​(Graph<SourceShape<Out2>,​Mat2> that,
                                                                            scala.Function2<Out,​Out2,​Out3> combine,
                                                                            scala.Function2<Mat,​Mat2,​Mat3> matF)
        Put together the elements of current flow and the given Source into a stream of combined elements using a combiner function, picking always the latest of the elements of each source.

      • zipLatestWithMat

        <Out2,​Out3,​Mat2,​Mat3> FlowOpsMat zipLatestWithMat​(Graph<SourceShape<Out2>,​Mat2> that,
                                                                            boolean eagerComplete,
                                                                            scala.Function2<Out,​Out2,​Out3> combine,
                                                                            scala.Function2<Mat,​Mat2,​Mat3> matF)
        Put together the elements of current flow and the given Source into a stream of combined elements using a combiner function, picking always the latest of the elements of each source.

      • zipMat

        <U,​Mat2,​Mat3> FlowOpsMat zipMat​(Graph<SourceShape<U>,​Mat2> that,
                                                    scala.Function2<Mat,​Mat2,​Mat3> matF)
        Combine the elements of current flow and the given Source into a stream of tuples.

      • zipWithMat

        <Out2,​Out3,​Mat2,​Mat3> FlowOpsMat zipWithMat​(Graph<SourceShape<Out2>,​Mat2> that,
                                                                      scala.Function2<Out,​Out2,​Out3> combine,
                                                                      scala.Function2<Mat,​Mat2,​Mat3> matF)
        Put together the elements of current flow and the given Source into a stream of combined elements using a combiner function.