Interface UniInterceptor
-
public interface UniInterceptor
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_ORDINAL
Default interceptor ordinal (100
).
-
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.default int
ordinal()
-
-
-
Field Detail
-
DEFAULT_ORDINAL
static final int DEFAULT_ORDINAL
Default interceptor ordinal (100
).- See Also:
- Constant Field Values
-
-
Method Detail
-
ordinal
default int ordinal()
- Returns:
- the interceptor ordinal. The ordinal is used to sort the interceptor. Lower value are executed first. Default is 100.
-
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.
-
-