Class BidiFlow$

java.lang.Object
org.apache.pekko.stream.javadsl.BidiFlow$

public class BidiFlow$ extends Object
  • Field Details

    • MODULE$

      public static final BidiFlow$ MODULE$
      Static reference to the singleton instance of this Scala object.
  • Constructor Details

    • BidiFlow$

      public BidiFlow$()
  • Method Details

    • identity

      public <A, B> BidiFlow<A,A,B,B,NotUsed> identity()
    • fromGraph

      public <I1, O1, I2, O2, M> BidiFlow<I1,O1,I2,O2,M> fromGraph(Graph<BidiShape<I1,O1,I2,O2>,M> g)
      A graph with the shape of a BidiFlow logically is a BidiFlow, this method makes it so also in type.
    • fromFlowsMat

      public <I1, O1, I2, O2, M1, M2, M> BidiFlow<I1,O1,I2,O2,M> fromFlowsMat(Graph<FlowShape<I1,O1>,M1> flow1, Graph<FlowShape<I2,O2>,M2> flow2, Function2<M1,M2,M> combine)
      Wraps two Flows to create a ''BidiFlow''. The materialized value of the resulting BidiFlow is determined by the combiner function passed in the second argument list.

      
           +----------------------------+
           | Resulting BidiFlow         |
           |                            |
           |  +----------------------+  |
       I1 ~~> |        Flow1         | ~~> O1
           |  +----------------------+  |
           |                            |
           |  +----------------------+  |
       O2 <~~ |        Flow2         | <~~ I2
           |  +----------------------+  |
           +----------------------------+
       
    • fromFlows

      public <I1, O1, I2, O2, M1, M2> BidiFlow<I1,O1,I2,O2,NotUsed> fromFlows(Graph<FlowShape<I1,O1>,M1> flow1, Graph<FlowShape<I2,O2>,M2> flow2)
      Wraps two Flows to create a ''BidiFlow''. The materialized value of the resulting BidiFlow is NotUsed.

      
           +----------------------------+
           | Resulting BidiFlow         |
           |                            |
           |  +----------------------+  |
       I1 ~~> |        Flow1         | ~~> O1
           |  +----------------------+  |
           |                            |
           |  +----------------------+  |
       O2 <~~ |        Flow2         | <~~ I2
           |  +----------------------+  |
           +----------------------------+
       
    • fromFunctions

      public <I1, O1, I2, O2> BidiFlow<I1,O1,I2,O2,NotUsed> fromFunctions(Function<I1,O1> top, Function<I2,O2> bottom)
      Create a BidiFlow where the top and bottom flows are just one simple mapping operator each, expressed by the two functions.
    • bidirectionalIdleTimeout

      public <I, O> BidiFlow<I,I,O,O,NotUsed> bidirectionalIdleTimeout(Duration timeout)
      If the time between two processed elements *in any direction* exceed the provided timeout, the stream is failed with a BackpressureTimeoutException.

      There is a difference between this operator and having two idleTimeout Flows assembled into a BidiStage. If the timeout is configured to be 1 seconds, then this operator will not fail even though there are elements flowing every second in one direction, but no elements are flowing in the other direction. I.e. this operator considers the *joint* frequencies of the elements in both directions.