reactor-core/src/main/java/reactor/core/publisher/Flux.java
public final <R> Flux<R> flatMap(
			@Nullable Function<? super T, ? extends Publisher<? extends R>> mapperOnNext,
			@Nullable Function<? super Throwable, ? extends Publisher<? extends R>> mapperOnError,
			@Nullable Supplier<? extends Publisher<? extends R>> mapperOnComplete) {
		return onAssembly(new FluxFlatMap<>(
				new FluxMapSignal<>(this, mapperOnNext, mapperOnError, mapperOnComplete),
				identityFunction(),
				false, Queues.XS_BUFFER_SIZE,
				Queues.xs(), Queues.XS_BUFFER_SIZE,
				Queues.xs()
		));
	}
public final <R> Flux<R> flatMap(
			@Nullable Function<? super T, ? extends Publisher<? extends R>> mapperOnNext,
			@Nullable Function<? super Throwable, ? extends Publisher<? extends R>> mapperOnError,
			@Nullable Supplier<? extends Publisher<? extends R>> mapperOnComplete) {
		return onAssembly(new FluxFlatMap<>(
				new FluxMapSignal<>(this, mapperOnNext, mapperOnError, mapperOnComplete),
				identityFunction(),
				false, Queues.XS_BUFFER_SIZE,
				Queues.xs(), Queues.XS_BUFFER_SIZE,
				Queues.xs()
		));
	}
Transform the signals emitted by this {@link Flux} asynchronously into Publishers,
then flatten these inner publishers into a single {@link Flux} through merging,
which allow them to interleave. Note that at least one of the signal mappers must
be provided, and all provided mappers must produce a publisher.
<p>
There are three dimensions to this operator that can be compared with
{@link #flatMapSequential(Function) flatMapSequential} and {@link #concatMap(Function) concatMap}:
<ul>
<li><b>Generation of inners and subscription</b>: this operator is eagerly
subscribing to its inners.</li>
<li><b>Ordering of the flattened values</b>: this operator does not necessarily preserve
original ordering, as inner element are flattened as they arrive.</li>
<li><b>Interleaving</b>: this operator lets values from different inners interleave
(similar to merging the inner sequences).</li>
</ul>
<p>
OnError will be transformed into completion signal after its mapping callback has been applied.
<p>
<img class="marble" src="doc-files/marbles/flatMapWithMappersOnTerminalEventsForFlux.svg" alt="">

@param mapperOnNext the {@link Function} to call on next data and returning a sequence to merge.
Use {@literal null} to ignore (provided at least one other mapper is specified).
@param mapperOnError the {@link Function} to call on error signal and returning a sequence to merge.
Use {@literal null} to ignore (provided at least one other mapper is specified).
@param mapperOnComplete the {@link Function} to call on complete signal and returning a sequence to merge.
Use {@literal null} to ignore (provided at least one other mapper is specified).
@param <R> the output {@link Publisher} type target

@return a new {@link Flux}