Class MergePreferred<T>

  • All Implemented Interfaces:

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

    A MergePreferred has one out port, one preferred input port and 1 or more secondary in ports.

    '''Emits when''' one of the inputs has an element available, preferring a specified input if multiple have elements 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 Detail

      • MergePreferred

        public MergePreferred​(int secondaryPorts,
                              boolean eagerComplete)
    • Method Detail

      • apply

        public static <T> MergePreferred<T> apply​(int secondaryPorts,
                                                  boolean eagerComplete)
        Create a new MergePreferred with the specified number of secondary input ports.

        secondaryPorts - number of secondary 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()
      • named

        public static Graph<S,​M> named​(java.lang.String name)
      • async

        public static Graph<S,​M> async()
      • async

        public static Graph<S,​M> async​(java.lang.String dispatcher)
      • async

        public static Graph<S,​M> async​(java.lang.String dispatcher,
                                             int inputBufferSize)
      • addAttributes

        public static Graph<S,​M> addAttributes​(Attributes attr)
      • withAttributes

        public static final Graph<S,​M> withAttributes​(Attributes attr)
      • createLogicAndMaterializedValue

        public static final scala.Tuple2<GraphStageLogic,​NotUsed> createLogicAndMaterializedValue​(Attributes inheritedAttributes)
      • secondaryPorts

        public int secondaryPorts()
      • eagerComplete

        public boolean eagerComplete()
      • shape

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

        public Inlet<T> in​(int id)
      • preferred

        public Inlet<T> preferred()