Package org.reactivestreams
Interface Subscriber<T>
- Type Parameters:
T
- the type of element signaled.
- All Known Subinterfaces:
Processor<T,
R>
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 TypeMethodDescriptionvoid
Successful terminal state.void
Failed terminal state.void
Data notification sent by thePublisher
in response to requests toSubscription.request(long)
.void
Invoked 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
Subscriber
instance to callSubscription.request(long)
whenever more data is wanted.The
Publisher
will send notifications only in response toSubscription.request(long)
.- Parameters:
s
-Subscription
that allows requesting data viaSubscription.request(long)
-
onNext
Data notification sent by thePublisher
in 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.
-