reactor-core/src/main/java/reactor/core/publisher/Flux.java
public static <T, S> Flux<T> generate(Callable<S> stateSupplier, BiFunction<S, SynchronousSink<T>, S> generator) {
		return onAssembly(new FluxGenerate<>(stateSupplier, generator));
	}
public static <T, S> Flux<T> generate(Callable<S> stateSupplier, BiFunction<S, SynchronousSink<T>, S> generator) {
		return onAssembly(new FluxGenerate<>(stateSupplier, generator));
	}
public static < T , S > Flux < T > generate ( Callable < S > stateSupplier , BiFunction < S , SynchronousSink < T > , S > generator ) { return onAssembly ( new FluxGenerate <> ( stateSupplier , generator ) ) ; }
Programmatically create a {@link Flux} by generating signals one-by-one via a
consumer callback and some state. The {@code stateSupplier} may return {@literal null}.
<p>
<img class="marble" src="doc-files/marbles/generate.svg" alt="">

@param <T> the value type emitted
@param <S> the per-subscriber custom state type
@param stateSupplier called for each incoming Subscriber to provide the initial state for the generator bifunction
@param generator Consume the {@link SynchronousSink} provided per-subscriber by Reactor
as well as the current state to generate a <strong>single</strong> signal on each pass
and return a (new) state.
@return a {@link Flux}
Programmatically create a { @link Flux } by generating signals one - by - one via a consumer callback and some state . The { @code stateSupplier } may return { @literal null } . <p > <img class = marble src = doc - files / marbles / generate . svg alt = >