Interface Subscriber<T>
- Type Parameters:
T- the type of element signaled
- All Known Subinterfaces:
Processor<T,R>
- All Known Implementing Classes:
AsyncSubscriber, FlowAdapters.ReactiveToFlowProcessor, FlowAdapters.ReactiveToFlowSubscriber, IdentityProcessorVerification.ManualSubscriberWithErrorCollection, SubscriberWhiteboxVerification.BlackboxSubscriberProxy, SyncSubscriber, TestEnvironment.BlackholeSubscriberWithSubscriptionSupport, TestEnvironment.ManualSubscriber, TestEnvironment.ManualSubscriberWithSubscriptionSupport, TestEnvironment.TestSubscriber
public interface Subscriber<T>
Will receive call to
onSubscribe(Subscription) once after passing an instance of Subscriber to Publisher.subscribe(Subscriber).
No further notifications will be received until Subscription.request(long) is called.
After signaling demand:
- One or more invocations of
onNext(Object)up to the maximum number defined bySubscription.request(long) - Single invocation of
onError(Throwable)oronComplete()which signals a terminal state after which no further events will be sent.
Demand can be signaled via Subscription.request(long) whenever the Subscriber instance is capable of handling more.
-
Method Summary
Modifier and TypeMethodDescriptionvoidSuccessful terminal state.voidFailed terminal state.voidData notification sent by thePublisherin response to requests toSubscription.request(long).voidInvoked after callingPublisher.subscribe(Subscriber).
-
Method Details
-
onSubscribe
Invoked after callingPublisher.subscribe(Subscriber).No data will start flowing until
Subscription.request(long)is invoked.It is the responsibility of this
Subscriberinstance to callSubscription.request(long)whenever more data is wanted.The
Publisherwill send notifications only in response toSubscription.request(long).- Parameters:
s- theSubscriptionthat allows requesting data viaSubscription.request(long)
-
onNext
Data notification sent by thePublisherin response to requests toSubscription.request(long).- Parameters:
t- the element signaled
-
onError
Failed terminal state.No further events will be sent even if
Subscription.request(long)is invoked again.- Parameters:
t- the throwable signaled
-
onComplete
void onComplete()Successful terminal state.No further events will be sent even if
Subscription.request(long)is invoked again.
-