Interface UniInterceptor
-
- All Superinterfaces:
MutinyInterceptor
public interface UniInterceptor extends MutinyInterceptor
-
-
Field Summary
-
Fields inherited from interface io.smallrye.mutiny.infrastructure.MutinyInterceptor
DEFAULT_ORDINAL
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default <T> UniSubscriber<? super T>
onSubscription(Uni<T> instance, UniSubscriber<? super T> subscriber)
Method called when a subscriber subscribes to aUni
.default <T> Uni<T>
onUniCreation(Uni<T> uni)
Method called when a new instance ofUni
is created.-
Methods inherited from interface io.smallrye.mutiny.infrastructure.MutinyInterceptor
ordinal
-
-
-
-
Method Detail
-
onUniCreation
default <T> Uni<T> onUniCreation(Uni<T> uni)
Method called when a new instance ofUni
is created. If can return a newUni
, or the passedUni
(default behavior) if the interceptor is not interested by thisuni
.One use case for this method is the capture of a context at creation time (when the method is called) and restored when a subscriber subscribed to the produced
uni
. It is recommended to extendAbstractUni
to produce a newUni
instance.- Type Parameters:
T
- the type of item produced by the uni- Parameters:
uni
- the created uni- Returns:
- the passed uni or a new instance, must not be
null
-
onSubscription
default <T> UniSubscriber<? super T> onSubscription(Uni<T> instance, UniSubscriber<? super T> subscriber)
Method called when a subscriber subscribes to aUni
. This method lets you substitute the subscriber.- Type Parameters:
T
- the type of item- Parameters:
instance
- the instance of unisubscriber
- the subscriber- Returns:
- the subscriber to use instead of the passed one. By default, it returns the given subscriber.
-
-