Class Interleave<T>

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

    public final class Interleave<T>
    extends GraphStage<UniformFanInShape<T,​T>>
    Interleave represents deterministic merge which takes N elements per input stream, in-order of inputs, emits them downstream and then cycles/"wraps-around" the inputs.

    '''Emits when''' element is available from current input (depending on phase)

    '''Backpressures when''' downstream backpressures

    '''Completes when''' all upstreams complete (eagerClose=false) or one upstream completes (eagerClose=true)

    '''Cancels when''' downstream cancels

    • Constructor Detail

      • Interleave

        public Interleave​(int inputPorts,
                          int segmentSize,
                          boolean eagerClose)
    • Method Detail

      • apply

        public static <T> Graph<UniformFanInShape<T,​T>,​NotUsed> apply​(int inputPorts,
                                                                                  int segmentSize,
                                                                                  boolean eagerClose)
        Create a new Interleave with the specified number of input ports and given size of elements to take from each input.

        Parameters:
        inputPorts - number of input ports
        segmentSize - number of elements to send downstream before switching to next input port
        eagerClose - if true, interleave completes upstream if any of its upstream completes.
      • apply$default$3

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

        public int inputPorts()
      • segmentSize

        public int segmentSize()
      • eagerClose

        public boolean eagerClose()
      • in

        public scala.collection.immutable.IndexedSeq<Inlet<T>> in()
      • 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.
      • toString

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