Emitted by Observables returned by rx.lang.scala.Observable.materialize.
The Observable interface that implements the Reactive Pattern.
Placeholder for extension methods into Observable[T] from other types
Provides a mechanism for receiving push-based notifications.
Provides a mechanism for receiving push-based notifications.
After an Observer calls an rx.lang.scala.Observable's subscribe
method, the Observable
calls the Observer's onNext
method to provide notifications. A well-behaved Observable will
call an Observer's onCompleted
or onError
methods exactly once.
Represents an object that schedules units of work.
A Subject is an Observable and an Observer at the same time.
An extension of the Observer trait which adds subscription handling
(unsubscribe, isUnsubscribed, and add
methods) and backpressure handling
(onStart and request methods).
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:
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.
Subscriptions are returned from all Observable.subscribe
methods to allow unsubscribing.
Subscriptions are returned from all Observable.subscribe
methods to allow unsubscribing.
This interface is the equivalent of IDisposable
in the .NET Rx implementation.
These function conversions convert between Scala functions and Rx Func
s and Action
s.
These function conversions convert between Scala functions and Rx Func
s and Action
s.
Most RxScala users won't need them, but they might be useful if one wants to use
the rx.Observable
directly instead of using rx.lang.scala.Observable
or if one wants
to use a Java library taking/returning Func
s and Action
s.
This object only contains conversions between functions. For conversions between types,
use rx.lang.scala.JavaConversions.
These functions convert between RxScala types RxJava types.
These functions convert between RxScala types RxJava types. Pure Scala projects won't need them, but they will be useful for polyglot projects. This object only contains conversions between types. For conversions between functions, use rx.lang.scala.ImplicitFunctionConversions.
Provides pattern matching support and constructors for Notifications.
Provides pattern matching support and constructors for Notifications.
Example:
import Notification._ Observable.just(1, 2, 3).materialize.subscribe(n => n match { case OnNext(v) => println("Got value " + v) case OnCompleted => println("Completed") case OnError(err) => println("Error: " + err.getMessage) })
Provides various ways to construct new Observables.
Subject that, once an Observer
has subscribed, emits all subsequently observed items to the
subscriber.
Subject that, once an Observer
has subscribed, emits all subsequently observed items to the
subscriber.
val subject = Subject[String]() // observer1 will receive all onNext and onCompleted events subject.subscribe(observer1) subject.onNext("one") subject.onNext("two") // observer2 will only receive "three" and onCompleted subject.subscribe(observer2) subject.onNext("three") subject.onCompleted()
Contains special Observables.
Contains special Observables.
In Scala, this package only contains rx.lang.scala.observables.BlockingObservable.
In the corresponding Java package rx.observables
, there is also a
GroupedObservable
and a ConnectableObservable
, but these are not needed
in Scala, because we use a pair (key, observable)
instead of GroupedObservable
and a pair (startFunction, observable)
instead of ConnectableObservable
.
Subjects are Observers and Observables at the same time.
This package contains all classes that RxScala users need.
It basically mirrors the structure of package
rx
, but some changes were made to make it more Scala-idiomatic.