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 toonSubscribe(Subscription)
once after passing an instance ofSubscriber
toPublisher.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 theSubscriber
instance is capable of handling more.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
onComplete()
Successful terminal state.void
onError(java.lang.Throwable t)
Failed terminal state.void
onNext(T t)
Data notification sent by thePublisher
in response to requests toSubscription.request(long)
.void
onSubscribe(Subscription s)
Invoked after callingPublisher.subscribe(Subscriber)
.
-
-
-
Method Detail
-
onSubscribe
void onSubscribe(Subscription s)
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
void onNext(T t)
Data notification sent by thePublisher
in response to requests toSubscription.request(long)
.- Parameters:
t
- the element signaled
-
onError
void onError(java.lang.Throwable t)
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.
-
-