- Type Parameters:
R- the type of resourceI- the type of item emitted by the resultingMulti
MultiResource, this version receives a () -> Uni<R>, meaning that the resource instance can be
resolved asynchronously.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMultiResourceUni(Supplier<Uni<R>> resourceSupplier, Function<? super R, ? extends Flow.Publisher<I>> streamSupplier) -
Method Summary
Modifier and TypeMethodDescriptionwithFinalizer(Consumer<? super R> finalizer) Configures a synchronous finalizer.withFinalizer(Function<? super R, Uni<Void>> finalizer) Configures an asynchronous finalizer.withFinalizer(Function<? super R, Uni<Void>> onCompletion, BiFunction<? super R, ? super Throwable, Uni<Void>> onFailure, Function<? super R, Uni<Void>> onCancellation) Configures asynchronous finalizers distinct for each event.
-
Constructor Details
-
MultiResourceUni
-
-
Method Details
-
withFinalizer
Configures a synchronous finalizer. The given function is called when the stream completes, fails or when the subscriber cancels. If the finalizer throws an exception, this exception is propagated to the subscriber, unless it has already cancelled.- Parameters:
finalizer- the finalizer, must not benull- Returns:
- the multi
-
withFinalizer
Configures an asynchronous finalizer. The given function is called when the stream completes, fails or when the subscriber cancels. The returnedUniis flattened with the stream meaning that the subscriber gets the events fired by theUni. If theUnicompletes successfully, the subscriber gets thecompletionevent. If theUnifails, the subscriber gets the failure even if the resource stream completed successfully. If theUnifails after a resource stream failure, the subscriber receives aCompositeException. If the subscribers cancels, theUnioutcome is ignored.If the finalizer throws an exception, this exception is propagated to the subscriber, unless it has already cancelled. If the finalizer returns
null, aNullPointerExceptionis propagated to the subscriber, unless it has already cancelled.- Parameters:
finalizer- the finalizer, must not benull- Returns:
- the multi
-
withFinalizer
@CheckReturnValue public Multi<I> withFinalizer(Function<? super R, Uni<Void>> onCompletion, BiFunction<? super R, ? super Throwable, Uni<Void>> onFailure, Function<? super R, Uni<Void>> onCancellation) Configures asynchronous finalizers distinct for each event. The given functions are called when the stream completes, fails or when the subscriber cancels.The returned
Uniis flattened with the stream meaning that the subscriber gets the events fired by theUni. If theUnicompletes successfully, the subscriber gets thecompletionevent. If theUnifails, the subscriber gets the failure even if the resource stream completed successfully. If theUnifails after a resource stream failure, the subscriber receives aCompositeException. If the subscribers cancels, theUnioutcome is ignored.If a finalizer throws an exception, this exception is propagated to the subscriber, unless it has already cancelled. If a finalizer returns
null, aNullPointerExceptionis propagated to the subscriber, unless it has already cancelled.- Parameters:
onCompletion- the completion finalizer called when the resource stream completes successfully. Must not benullonFailure- the failure finalizer called when the resource stream propagated a failure. The finalizer is called with the resource and the failure. Must not benullonCancellation- the cancellation finalizer called when the subscribers cancels the subscription. Must not benull.- Returns:
- the multi
-