-
- Type Parameters:
T- the type of item.
- All Superinterfaces:
java.util.concurrent.Flow.Subscriber<T>
- All Known Subinterfaces:
CancellableSubscriber<T>
- All Known Implementing Classes:
AssertSubscriber,MultiSubscriberAdapter,SerializedSubscriber,Subscribers.CallbackBasedSubscriber,SwitchableSubscriptionSubscriber
public interface MultiSubscriber<T> extends java.util.concurrent.Flow.Subscriber<T>AFlow.Subscriberreceiving calls toFlow.Subscriber.onSubscribe(Subscription)once after passing an instance ofFlow.SubscribertoFlow.Publisher.subscribe(Subscriber).No further events will be received until
Flow.Subscription.request(long)is called.After signaling demand:
- One or more invocations of
onItem(Object)up to the maximum number defined byFlow.Subscription.request(long) - Single invocation of
onFailure(Throwable)oronCompletion()which signals a terminal state after which no further events will be sent.
Demand can be signaled via
Flow.Subscription.request(long)whenever theFlow.Subscriberinstance is capable of handling more.This interface bridges the Mutiny model and the Reactive Streams model.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidonComplete()Successful terminal state.voidonCompletion()Method called when the upstream emits acompletionterminal event.default voidonError(java.lang.Throwable t)Failed terminal state.voidonFailure(java.lang.Throwable failure)Method called when the upstream emits afailureterminal event.voidonItem(T item)Method called when the upstream emits anitemevent, in response to to requests toFlow.Subscription.request(long).default voidonNext(T t)Data notification sent by theFlow.Publisherin response to requests toFlow.Subscription.request(long).
-
-
-
Method Detail
-
onItem
void onItem(T item)
Method called when the upstream emits anitemevent, in response to to requests toFlow.Subscription.request(long).- Parameters:
item- the item, must not benull.
-
onFailure
void onFailure(java.lang.Throwable failure)
Method called when the upstream emits afailureterminal event.No further events will be sent even if
Flow.Subscription.request(long)is invoked again.- Parameters:
failure- the failure, must not benull.
-
onCompletion
void onCompletion()
Method called when the upstream emits acompletionterminal event.No further events will be sent even if
Flow.Subscription.request(long)is invoked again.
-
onNext
default void onNext(T t)
Data notification sent by theFlow.Publisherin response to requests toFlow.Subscription.request(long). Delegates toonItem(Object)- Specified by:
onNextin interfacejava.util.concurrent.Flow.Subscriber<T>- Parameters:
t- the element signaled
-
onError
default void onError(java.lang.Throwable t)
Failed terminal state.No further events will be sent even if
Flow.Subscription.request(long)is invoked again. Delegates toonFailure(Throwable)- Specified by:
onErrorin interfacejava.util.concurrent.Flow.Subscriber<T>- Parameters:
t- the throwable signaled
-
onComplete
default void onComplete()
Successful terminal state.No further events will be sent even if
Flow.Subscription.request(long)is invoked again. Delegates toonCompletion()- Specified by:
onCompletein interfacejava.util.concurrent.Flow.Subscriber<T>
-
-