public static <T, D> Flux<T> usingWhen(Publisher<D> resourceSupplier,
			Function<? super D, ? extends Publisher<? extends T>> resourceClosure,
			Function<? super D, ? extends Publisher<?>> asyncCleanup) {
    """
	Uses a resource, generated by a {@link Publisher} for each individual {@link Subscriber},
	while streaming the values from a {@link Publisher} derived from the same resource.
	Whenever the resulting sequence terminates, a provided {@link Function} generates
	a "cleanup" {@link Publisher} that is invoked but doesn't change the content of the
	main sequence. Instead it just defers the termination (unless it errors, in which case
	the error suppresses the original termination signal).
	<p>
	Note that if the resource supplying {@link Publisher} emits more than one resource, the
	subsequent resources are dropped ({@link Operators#onNextDropped(Object, Context)}). If
	the publisher errors AFTER having emitted one resource, the error is also silently dropped
	({@link Operators#onErrorDropped(Throwable, Context)}).
	An empty completion or error without at least one onNext signal triggers a short-circuit
	of the main sequence with the same terminal signal (no resource is established, no
	cleanup is invoked).
	
	<p>
	<img class="marble" src="doc-files/marbles/usingWhenSuccessForFlux.svg" alt="">
	
	@param resourceSupplier a {@link Publisher} that "generates" the resource,
	subscribed for each subscription to the main sequence
	@param resourceClosure a factory to derive a {@link Publisher} from the supplied resource
	@param asyncCleanup an asynchronous resource cleanup invoked when the resource
	closure terminates (with onComplete, onError or cancel)
	@param <T> the type of elements emitted by the resource closure, and thus the main sequence
	@param <D> the type of the resource object
	@return a new {@link Flux} built around a "transactional" resource, with asynchronous
	cleanup on all terminations (onComplete, onError, cancel)
	@see #usingWhen(Publisher, Function, Function, Function, Function)
    """
		return usingWhen(resourceSupplier, resourceClosure, asyncCleanup, asyncCleanup);
	}
public static <T, D> Flux<T> usingWhen(Publisher<D> resourceSupplier,
			Function<? super D, ? extends Publisher<? extends T>> resourceClosure,
			Function<? super D, ? extends Publisher<?>> asyncCleanup) {
		return usingWhen(resourceSupplier, resourceClosure, asyncCleanup, asyncCleanup);
	}
public static < T , D > Flux < T > usingWhen ( Publisher < D > resourceSupplier , Function < ? super D , ? extends Publisher < ? extends T > > resourceClosure , Function < ? super D , ? extends Publisher < ? > > asyncCleanup ) { return usingWhen ( resourceSupplier , resourceClosure , asyncCleanup , asyncCleanup ) ; }
Uses a resource, generated by a {@link Publisher} for each individual {@link Subscriber},
while streaming the values from a {@link Publisher} derived from the same resource.
Whenever the resulting sequence terminates, a provided {@link Function} generates
a "cleanup" {@link Publisher} that is invoked but doesn't change the content of the
main sequence. Instead it just defers the termination (unless it errors, in which case
the error suppresses the original termination signal).
<p>
Note that if the resource supplying {@link Publisher} emits more than one resource, the
subsequent resources are dropped ({@link Operators#onNextDropped(Object, Context)}). If
the publisher errors AFTER having emitted one resource, the error is also silently dropped
({@link Operators#onErrorDropped(Throwable, Context)}).
An empty completion or error without at least one onNext signal triggers a short-circuit
of the main sequence with the same terminal signal (no resource is established, no
cleanup is invoked).

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

@param resourceSupplier a {@link Publisher} that "generates" the resource,
subscribed for each subscription to the main sequence
@param resourceClosure a factory to derive a {@link Publisher} from the supplied resource
@param asyncCleanup an asynchronous resource cleanup invoked when the resource
closure terminates (with onComplete, onError or cancel)
@param <T> the type of elements emitted by the resource closure, and thus the main sequence
@param <D> the type of the resource object
@return a new {@link Flux} built around a "transactional" resource, with asynchronous
cleanup on all terminations (onComplete, onError, cancel)
@see #usingWhen(Publisher, Function, Function, Function, Function)
Uses a resource generated by a { @link Publisher } for each individual { @link Subscriber } while streaming the values from a { @link Publisher } derived from the same resource . Whenever the resulting sequence terminates a provided { @link Function } generates a cleanup { @link Publisher } that is invoked but doesn t change the content of the main sequence . Instead it just defers the termination ( unless it errors in which case the error suppresses the original termination signal ) . <p > Note that if the resource supplying { @link Publisher } emits more than one resource the subsequent resources are dropped ( { @link Operators#onNextDropped ( Object Context ) } ) . If the publisher errors AFTER having emitted one resource the error is also silently dropped ( { @link Operators#onErrorDropped ( Throwable Context ) } ) . An empty completion or error without at least one onNext signal triggers a short - circuit of the main sequence with the same terminal signal ( no resource is established no cleanup is invoked ) .