rx.lang.scala

Subscriber

abstract class Subscriber[-T] extends Observer[T] with Subscription

An extension of the Observer trait which adds subscription handling (unsubscribe, isUnsubscribed, and add methods) and backpressure handling (onStart and request methods).

Similarly to the RxJava Subscriber, this class has two constructors:

The first constructor takes as argument the child Subscriber from further down the pipeline and is usually only needed together with lift:

myObservable.lift((subscriber: Subscriber[T]) => new Subscriber[T](subscriber) {
  override def onStart(): Unit = ...
  override def onNext(n: T): Unit = ...
  override def onError(e: Throwable): Unit = ...
  override def onCompleted(): Unit = ...
})

The second constructor takes no arguments and is typically used with the subscribe method:

myObservable.subscribe(new Subscriber[T] {
  override def onStart(): Unit = ...
  override def onNext(n: T): Unit = ...
  override def onError(e: Throwable): Unit = ...
  override def onCompleted(): Unit = ...
})

Notice that these two constructors are not (as usually in Scala) in the companion object, because if they were, we couldn't create anonymous classes implementing onStart/onNext/onError/onCompleted as in the examples above. However, there are more constructors in the companion object, which allow you to construct Subscribers from given onNext/onError/onCompleted lambdas.

Self Type
Subscriber[T]
Linear Supertypes
Subscription, Observer[T], AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Subscriber
  2. Subscription
  3. Observer
  4. AnyRef
  5. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Subscriber()

  2. new Subscriber(subscriber: Subscriber[_])

Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. final def add(u: ⇒ Unit): Unit

    Register a callback to be run when Subscriber is unsubscribed

    Register a callback to be run when Subscriber is unsubscribed

    u

    callback to run when unsubscribed

  5. final def add(s: Subscription): Unit

    Used to register an unsubscribe callback.

  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  12. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  13. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  14. final def isUnsubscribed: Boolean

    Checks if the subscription is unsubscribed.

    Checks if the subscription is unsubscribed.

    Definition Classes
    SubscriberSubscription
  15. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  16. final def notify(): Unit

    Definition Classes
    AnyRef
  17. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  18. def onCompleted(): Unit

    Notifies the Observer that the rx.lang.scala.Observable has finished sending push-based notifications.

    Notifies the Observer that the rx.lang.scala.Observable has finished sending push-based notifications.

    The rx.lang.scala.Observable will not call this method if it calls onError.

    Definition Classes
    Observer
  19. def onError(error: Throwable): Unit

    Notifies the Observer that the rx.lang.scala.Observable has experienced an error condition.

    Notifies the Observer that the rx.lang.scala.Observable has experienced an error condition.

    If the rx.lang.scala.Observable calls this method, it will not thereafter call onNext or onCompleted.

    Definition Classes
    Observer
  20. def onNext(value: T): Unit

    Provides the Observer with new data.

    Provides the Observer with new data.

    The rx.lang.scala.Observable calls this closure 0 or more times.

    The rx.lang.scala.Observable will not call this method again after it calls either onCompleted or onError.

    Definition Classes
    Observer
  21. def onStart(): Unit

  22. final def request(n: Long): Unit

    Attributes
    protected[this]
  23. def setProducer(producer: (Long) ⇒ Unit): Unit

  24. def setProducer(producer: Producer): Unit

  25. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  26. def toString(): String

    Definition Classes
    AnyRef → Any
  27. final def unsubscribe(): Unit

    Call this method to stop receiving notifications on the Observer that was registered when this Subscription was received.

    Call this method to stop receiving notifications on the Observer that was registered when this Subscription was received.

    Definition Classes
    SubscriberSubscription
  28. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Subscription

Inherited from Observer[T]

Inherited from AnyRef

Inherited from Any

Ungrouped