Interface MultiInterceptor
-
- All Superinterfaces:
MutinyInterceptor
public interface MultiInterceptor 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> 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
.-
Methods inherited from interface io.smallrye.mutiny.infrastructure.MutinyInterceptor
ordinal
-
-
-
-
Method Detail
-
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.
-
-