reactor-core/src/main/java/reactor/core/publisher/Flux.java
public final <K, V> Flux<GroupedFlux<K, V>> groupBy(Function<? super T, ? extends K> keyMapper,
			Function<? super T, ? extends V> valueMapper, int prefetch) {
		return onAssembly(new FluxGroupBy<>(this, keyMapper, valueMapper,
				Queues.unbounded(prefetch),
				Queues.unbounded(prefetch), prefetch));
	}
public final <K, V> Flux<GroupedFlux<K, V>> groupBy(Function<? super T, ? extends K> keyMapper,
			Function<? super T, ? extends V> valueMapper, int prefetch) {
		return onAssembly(new FluxGroupBy<>(this, keyMapper, valueMapper,
				Queues.unbounded(prefetch),
				Queues.unbounded(prefetch), prefetch));
	}
public final < K , V > Flux < GroupedFlux < K , V > > groupBy ( Function < ? super T , ? extends K > keyMapper , Function < ? super T , ? extends V > valueMapper , int prefetch ) { return onAssembly ( new FluxGroupBy <> ( this , keyMapper , valueMapper , Queues . unbounded ( prefetch ) , Queues . unbounded ( prefetch ) , prefetch ) ) ; }
Divide this sequence into dynamically created {@link Flux} (or groups) for each
unique key, as produced by the provided keyMapper {@link Function}. Source elements
are also mapped to a different value using the {@code valueMapper}. Note that
groupBy works best with a low cardinality of groups, so chose your keyMapper
function accordingly.

<p>
<img class="marble" src="doc-files/marbles/groupByWithKeyMapperAndValueMapper.svg" alt="">

<p>
The groups need to be drained and consumed downstream for groupBy to work correctly.
Notably when the criteria produces a large amount of groups, it can lead to hanging
if the groups are not suitably consumed downstream (eg. due to a {@code flatMap}
with a {@code maxConcurrency} parameter that is set too low).

@param keyMapper the key mapping function that evaluates an incoming data and returns a key.
@param valueMapper the value mapping function that evaluates which data to extract for re-routing.
@param prefetch the number of values to prefetch from the source

@param <K> the key type extracted from each value of this sequence
@param <V> the value type extracted from each value of this sequence

@return a {@link Flux} of {@link GroupedFlux} grouped sequences
Divide this sequence into dynamically created { @link Flux } ( or groups ) for each unique key as produced by the provided keyMapper { @link Function } . Source elements are also mapped to a different value using the { @code valueMapper } . Note that groupBy works best with a low cardinality of groups so chose your keyMapper function accordingly .