Class Merge<T>

All Implemented Interfaces:
Graph<UniformFanInShape<T,T>,NotUsed>

public final class Merge<T> extends GraphStage<UniformFanInShape<T,T>>
Merge several streams, taking elements as they arrive from input streams (picking randomly when several have elements ready).

'''Emits when''' one of the inputs has an element available

'''Backpressures when''' downstream backpressures

'''Completes when''' all upstreams complete (eagerComplete=false) or one upstream completes (eagerComplete=true), default value is false

'''Cancels when''' downstream cancels

  • Constructor Details

    • Merge

      public Merge(int inputPorts, boolean eagerComplete)
  • Method Details

    • apply

      public static <T> Merge<T> apply(int inputPorts, boolean eagerComplete)
      Create a new Merge with the specified number of input ports.

      Parameters:
      inputPorts - number of input ports
      eagerComplete - if true, the merge will complete as soon as one of its inputs completes.
    • apply$default$2

      public static <T> boolean apply$default$2()
    • inputPorts

      public int inputPorts()
    • eagerComplete

      public boolean eagerComplete()
    • in

      public scala.collection.immutable.IndexedSeq<Inlet<T>> in()
    • out

      public Outlet<T> out()
    • initialAttributes

      public Attributes initialAttributes()
      Overrides:
      initialAttributes in class GraphStageWithMaterializedValue<UniformFanInShape<T,T>,NotUsed>
    • shape

      public UniformFanInShape<T,T> shape()
      Description copied from interface: Graph
      The shape of a graph is all that is externally visible: its inlets and outlets.
    • createLogic

      public GraphStageLogic createLogic(Attributes inheritedAttributes)
      Specified by:
      createLogic in class GraphStage<UniformFanInShape<T,T>>
    • toString

      public String toString()
      Overrides:
      toString in class Object