R - the type of resourceI - the type of item emitted by the resulting Multipublic class MultiResource<R,I> extends Object
MultiCreate.resource(Supplier, Function)| Constructor and Description |
|---|
MultiResource(Supplier<? extends R> resourceSupplier,
Function<? super R,? extends org.reactivestreams.Publisher<I>> streamSupplier) |
| Modifier and Type | Method and Description |
|---|---|
Multi<I> |
withFinalizer(Consumer<? super R> finalizer)
Configures a synchronous finalizer.
|
Multi<I> |
withFinalizer(Function<? super R,Uni<Void>> finalizer)
Configures an asynchronous finalizer.
|
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.
|
public Multi<I> withFinalizer(Consumer<? super R> finalizer)
finalizer - the finalizer, must not be nullpublic Multi<I> withFinalizer(Function<? super R,Uni<Void>> finalizer)
Uni is flattened with the stream meaning that the subscriber
gets the events fired by the Uni. If the Uni completes successfully, the subscriber gets
the completion event. If the Uni fails, the subscriber gets the failure even if the resource
stream completed successfully. If the Uni fails after a resource stream failure, the subscriber receives
a CompositeException. If the subscribers cancels, the Uni outcome 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, a NullPointerException is propagated to the subscriber, unless it
has already cancelled.
finalizer - the finalizer, must not be nullpublic Multi<I> withFinalizer(Function<? super R,Uni<Void>> onCompletion, BiFunction<? super R,? super Throwable,Uni<Void>> onFailure, Function<? super R,Uni<Void>> onCancellation)
The returned Uni is flattened with the stream meaning that the subscriber
gets the events fired by the Uni. If the Uni completes successfully, the subscriber gets
the completion event. If the Uni fails, the subscriber gets the failure even if the resource
stream completed successfully. If the Uni fails after a resource stream failure, the subscriber receives
a CompositeException. If the subscribers cancels, the Uni outcome 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, a NullPointerException is propagated to the subscriber, unless it
has already cancelled.
onCompletion - the completion finalizer called when the resource stream completes successfully. Must not be
nullonFailure - the failure finalizer called when the resource stream propagated a failure. The finalizer is
called with the resource and the failure. Must not be nullonCancellation - the cancellation finalizer called when the subscribers cancels the subscription. Must not
be null.Copyright © 2019–2020 SmallRye. All rights reserved.