Class MultiFlatten<I,O>

java.lang.Object
io.smallrye.mutiny.groups.MultiFlatten<I,O>
Type Parameters:
I - the type of item emitted by the upstream Multi
O - the type of item emitted by the returned Multi

public class MultiFlatten<I,O> extends Object
The object to tune the flatMap operation
  • Method Details

    • collectFailures

      @CheckReturnValue public MultiFlatten<I,O> collectFailures()
      Instructs the flatMap operation to consume all the streams returned by the mapper before propagating a failure if any of the stream has produced a failure.

      If more than one failure is collected, the propagated failure is a CompositeException.

      Returns:
      this MultiFlatten
    • withRequests

      @CheckReturnValue public MultiFlatten<I,O> withRequests(int requests)
      Configures the number the items requested to the streams produced by the mapper.
      Parameters:
      requests - the requests, must be strictly positive
      Returns:
      this MultiFlatten
    • merge

      @CheckReturnValue public Multi<O> merge()
      Produces a Multi containing the items from Flow.Publisher produced by the mapper for each item emitted by this Multi.

      The operators behaves as follows:

      • for each item emitted by this Multi, the mapper is called and produces a Flow.Publisher (potentially a Multi). The mapper must not return null
      • The items contained in each of the produced Flow.Publisher are then merged in the produced Multi. The returned object lets you configure the flattening process.
      Returns:
      the object to configure the flatMap operation.
    • merge

      @CheckReturnValue public Multi<O> merge(int concurrency)
      Produces a Multi containing the items from Flow.Publisher produced by the mapper for each item emitted by this Multi.

      The operators behaves as follows:

      • for each item emitted by this Multi, the mapper is called and produces a Flow.Publisher (potentially a Multi). The mapper must not return null
      • The items contained in each of the produced Flow.Publisher are then merged in the produced Multi. The returned object lets you configure the flattening process.

      This method allows configuring the concurrency, i.e. the maximum number of in-flight/subscribed inner streams

      Parameters:
      concurrency - the concurrency
      Returns:
      the object to configure the flatMap operation.
    • concatenate

      @CheckReturnValue public Multi<O> concatenate(boolean prefetch)
      Produces a Multi containing the items from Flow.Publisher produced by the mapper for each item emitted by this Multi.

      The operators behaves as follows:

      • for each item emitted by this Multi, the mapper is called and produces a Flow.Publisher (potentially a Multi). The mapper must not return null
      • The items contained in each of the produced Flow.Publisher are then concatenated in the produced Multi. The returned object lets you configure the flattening process.
      • If prefetch is set to true, flatMap operator is used with upstream prefetch of requests parameter configured previously.
      • If prefetch is set to false, concatMap operator is used without prefetch, meaning that items are requested lazily from the upstream, one at a time.
      Parameters:
      prefetch - whether the operator prefetches items from upstream, or not.
      Returns:
      the object to configure the concatMap operation.
    • concatenate

      @CheckReturnValue public Multi<O> concatenate()
      Produces a Multi containing the items from Flow.Publisher produced by the mapper for each item emitted by this Multi.

      The operators behaves as follows:

      • for each item emitted by this Multi, the mapper is called and produces a Flow.Publisher (potentially a Multi). The mapper must not return null
      • The items contained in each of the produced Flow.Publisher are then concatenated in the produced Multi. The returned object lets you configure the flattening process.
      • This operator defaults to without prefetch, meaning that items are requested lazily from the upstream, one at a time.
      Returns:
      the object to configure the concatMap operation.