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 enum 
    Options to handle backpressure in the emitter.
    static interface 
    A functional interface that has a single close method that can throw.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    The current outstanding request amount.
    void
    Sets a Cancellable on this emitter; any previous Subscription or Cancellation will be unsubscribed/cancelled.
    void
    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 Details

    • 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