Object
SimpleSubscriber<T>
- All Implemented Interfaces:
ReplayableSubscriber<T>
,Flow.Subscriber<T>
- Direct Known Subclasses:
CollectorSubscriber
,FixedCollectorSubscriber
Simple implementation for
Flow.Subscriber
interface which can be
subscribed only once.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns subscription if subscriber is already subscribedboolean
void
Emptyvoid
Prints stack trace for the given exception to stderrvoid
Emptyvoid
onSubscribe
(Flow.Subscription subscription) Saves subscription and requestswithInitialRequest(int)
number of items.void
EmptywithInitialRequest
(int numOfMessages) Allows to set how many messages to request once this subscriber will be first subscribed to some topic.
-
Field Details
-
subscription
-
-
Constructor Details
-
SimpleSubscriber
public SimpleSubscriber()
-
-
Method Details
-
withInitialRequest
Allows to set how many messages to request once this subscriber will be first subscribed to some topic. Default number is one. -
onSubscribe
Saves subscription and requestswithInitialRequest(int)
number of items.- Specified by:
onSubscribe
in interfaceFlow.Subscriber<T>
- Throws:
PreconditionException
- if subscriber is already subscribed
-
onNext
Empty- Specified by:
onNext
in interfaceFlow.Subscriber<T>
-
onError
Prints stack trace for the given exception to stderr- Specified by:
onError
in interfaceFlow.Subscriber<T>
-
onComplete
public void onComplete()Empty- Specified by:
onComplete
in interfaceFlow.Subscriber<T>
-
getSubscription
Returns subscription if subscriber is already subscribed -
replay
Empty- Specified by:
replay
in interfaceReplayableSubscriber<T>
-
isSubscribed
public boolean isSubscribed()
-