Class Partition<T>

  • All Implemented Interfaces:
    Graph<UniformFanOutShape<T,​T>,​NotUsed>

    public final class Partition<T>
    extends GraphStage<UniformFanOutShape<T,​T>>
    Fan-out the stream to several streams. emitting an incoming upstream element to one downstream consumer according to the partitioner function applied to the element

    '''Emits when''' emits when an element is available from the input and the chosen output has demand

    '''Backpressures when''' the currently chosen output back-pressures

    '''Completes when''' upstream completes and no output is pending

    '''Cancels when''' all downstreams have cancelled (eagerCancel=false) or one downstream cancels (eagerCancel=true)

    • Constructor Detail

      • Partition

        public Partition​(int outputPorts,
                         scala.Function1<T,​java.lang.Object> partitioner,
                         boolean eagerCancel)
      • Partition

        public Partition​(int outputPorts,
                         scala.Function1<T,​java.lang.Object> partitioner)
        Deprecated.
        Use the constructor which also specifies the `eagerCancel` parameter. Since .
        Sets eagerCancel to false.
        Parameters:
        outputPorts - (undocumented)
        partitioner - (undocumented)
    • Method Detail

      • apply

        public static <T> Partition<T> apply​(int outputPorts,
                                             scala.Function1<T,​java.lang.Object> partitioner)
        Create a new Partition operator with the specified input type. This method sets eagerCancel to false. To specify a different value for the eagerCancel parameter, then instantiate Partition using the constructor.

        If eagerCancel is true, partition cancels upstream if any of its downstreams cancel, if false, when all have cancelled.

        Parameters:
        outputPorts - number of output ports
        partitioner - function deciding which output each element will be targeted
        Returns:
        (undocumented)
      • 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)
      • initialAttributes

        protected static Attributes initialAttributes()
      • withAttributes

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

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

        public int outputPorts()
      • partitioner

        public scala.Function1<T,​java.lang.Object> partitioner()
      • eagerCancel

        public boolean eagerCancel()
      • out

        public scala.collection.Seq<Outlet<T>> out()
      • shape

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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object