Class Spread<T,R>

java.lang.Object
mutiny.zero.operators.Spread<T,R>
Type Parameters:
T - the upstream item type
R - the downstream (flattened) item type
All Implemented Interfaces:
Flow.Publisher<R>

public class Spread<T,R> extends Object implements Flow.Publisher<R>
A Flow.Publisher that maps each upstream item to a Flow.Publisher and flattens the results with bounded concurrency.

With concurrency = 1 this behaves as a concatMap (strict ordering). With concurrency > 1 items from different inner publishers may interleave.

  • Constructor Details

    • Spread

      public Spread(Flow.Publisher<T> upstream, Function<T,@Nullable Flow.Publisher<R>> mapper, int concurrency, int prefetch)
      Create a new spread (flatMap) publisher.
      Parameters:
      upstream - the upstream publisher, must not be null
      mapper - the mapping function, must not be null
      concurrency - the maximum number of concurrent inner subscriptions, must be positive
      prefetch - the per-inner request batch size, must be positive
  • Method Details