Package rx
Interface AsyncEmitter<T>
-
- Type Parameters:
T- the value type to emit
- All Superinterfaces:
Observer<T>
- All Known Implementing Classes:
OnSubscribeFromAsync.BaseAsyncEmitter,OnSubscribeFromAsync.BufferAsyncEmitter,OnSubscribeFromAsync.DropAsyncEmitter,OnSubscribeFromAsync.ErrorAsyncEmitter,OnSubscribeFromAsync.LatestAsyncEmitter,OnSubscribeFromAsync.NoneAsyncEmitter,OnSubscribeFromAsync.NoOverflowBaseAsyncEmitter
@Experimental public interface AsyncEmitter<T> extends Observer<T>
Abstraction over a RxJava Subscriber that allows associating a resource with it and exposes the current number of downstream requested amount.The onNext, onError and onCompleted methods should be called in a sequential manner, just like the Observer's methods. The other methods are threadsafe.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classAsyncEmitter.BackpressureModeOptions to handle backpressure in the emitter.static interfaceAsyncEmitter.CancellableA functional interface that has a single close method that can throw.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description longrequested()The current outstanding request amount.voidsetCancellation(AsyncEmitter.Cancellable c)Sets a Cancellable on this emitter; any previous Subscription or Cancellation will be unsubscribed/cancelled.voidsetSubscription(Subscription s)Sets a Subscription on this emitter; any previous Subscription or Cancellation will be unsubscribed/cancelled.-
Methods inherited from interface rx.Observer
onCompleted, onError, onNext
-
-
-
-
Method Detail
-
setSubscription
void setSubscription(Subscription s)
Sets a Subscription on this emitter; any previous Subscription or Cancellation will be unsubscribed/cancelled.- Parameters:
s- the subscription, null is allowed
-
setCancellation
void setCancellation(AsyncEmitter.Cancellable c)
Sets a Cancellable on this emitter; any previous Subscription or Cancellation will be unsubscribed/cancelled.- Parameters:
c- the cancellable resource, null is allowed
-
requested
long requested()
The current outstanding request amount.This method it threadsafe.
- Returns:
- the current outstanding request amount
-
-