Interface MultiInterceptor
-
public interface MultiInterceptor
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_ORDINAL
Default ordinal value.
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default <T> Multi<T>
onMultiCreation(Multi<T> multi)
Method called when a new instance ofMulti
is created.default <T> org.reactivestreams.Subscriber<? super T>
onSubscription(org.reactivestreams.Publisher<? extends T> instance, org.reactivestreams.Subscriber<? super T> subscriber)
Method called when a subscriber subscribes to aMulti
.default int
ordinal()
-
-
-
Field Detail
-
DEFAULT_ORDINAL
static final int DEFAULT_ORDINAL
Default ordinal value.- 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.
-
onMultiCreation
default <T> Multi<T> onMultiCreation(Multi<T> multi)
Method called when a new instance ofMulti
is created. If can return a newMulti
, or the passedMulti
(default behavior) if the interceptor is not interested by thisMulti
.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
multi
. It is recommended to extendAbstractMulti
to produce a newMulti
instance.- Type Parameters:
T
- the type of item produced by the multi- Parameters:
multi
- the created multi- Returns:
- the passed multi or a new instance, must not be
null
-
onSubscription
default <T> org.reactivestreams.Subscriber<? super T> onSubscription(org.reactivestreams.Publisher<? extends T> instance, org.reactivestreams.Subscriber<? super T> subscriber)
Method called when a subscriber subscribes to aMulti
. This method lets you substitute the subscriber.- Type Parameters:
T
- the type of item- Parameters:
instance
- the instance of publishersubscriber
- the subscriber- Returns:
- the subscriber to use instead of the passed one. By default, it returns the given subscriber.
-
-