Create a Subscription using u
and add it to this Subscriber's list of Subscriptions if this list
is not marked as unsubscribed.
Create a Subscription using u
and add it to this Subscriber's list of Subscriptions if this list
is not marked as unsubscribed. If the list **is** marked as unsubscribed, it will call u
.
callback to run when unsubscribed
Add a Subscription to this Subscriber's list of Subscriptions if this list is not marked as unsubscribed.
Add a Subscription to this Subscriber's list of Subscriptions if this list is not marked as unsubscribed. If the list **is** marked as unsubscribed, it will unsubscribe the new Subscription as well.
the Subscription to add
Indicates whether this Subscriber has unsubscribed from its list of Subscriptions.
Indicates whether this Subscriber has unsubscribed from its list of Subscriptions.
true
if this Subscriber has unsubscribed from its Subscriptions, false
otherwise
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
.
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
.
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
.
This method is invoked when the Subscriber and Observable have been connected but the Observable has not yet begun to emit items or send notifications to the Subscriber.
This method is invoked when the Subscriber and Observable have been connected but the Observable has not yet begun to emit items or send notifications to the Subscriber. Override this method to add any useful initialization to your subscription, for instance to initiate backpressure.
Observable.just(1, 2, 3).subscribe(new Subscriber[Int]() { override def onStart(): Unit = request(1) override def onNext(v: Int): Unit = { println(v) request(1) } override def onError(e: Throwable): Unit = e.printStackTrace() override def onCompleted(): Unit = {} })
Request a certain maximum number of emitted items from the Observable this Subscriber is subscribed to.
Request a certain maximum number of emitted items from the Observable this Subscriber is subscribed to.
This is a way of requesting backpressure. To disable backpressure, pass Long.MaxValue
to this method.
the maximum number of items you want the Observable to emit to the Subscriber at this time, or
Long.MaxValue
if you want the Observable to emit items at its own pace
Unsubscribe all Subscriptions added to this Subscriber's .
Unsubscribe all Subscriptions added to this Subscriber's .
An extension of the Observer trait which adds subscription handling (unsubscribe, isUnsubscribed, and
add
methods) and backpressure handling (onStart and request methods).After a Subscriber calls an Observable's
subscribe
method, the Observable calls the Subscriber's onNext method to emit items. A well-behaved Observable will call a Subscriber's onCompleted method exactly once or the Subscriber's onError method exactly once.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:
The second constructor takes no arguments and is typically used with the subscribe method:
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 givenonNext
/onError
/onCompleted
lambdas.