Class 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 java.lang.Object
    The object to tune the flatMap operation
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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.
      Multi<O> concatenate()
      Produces a Multi containing the items from Flow.Publisher produced by the mapper for each item emitted by this Multi.
      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.
      Multi<O> merge()
      Produces a Multi containing the items from Flow.Publisher produced by the mapper for each item emitted by this Multi.
      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.
      MultiFlatten<I,​O> withRequests​(int requests)
      Configures the number the items requested to the streams produced by the mapper.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • 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.