A channel is meant for imperative style feeding of events.
Asynchronous implementation of the Observable interface
The Observer from the Rx pattern is the trio of callbacks that get subscribed to an Observable for receiving events.
The Observer from the Rx pattern is the trio of callbacks that get subscribed to an Observable for receiving events.
The events received must follow the Rx grammar, which is: onNext * (onComplete | onError)?
That means an Observer can receive zero or multiple events, the stream
ending either in one or zero onComplete
or onError
(just one, not both),
and after onComplete or onError, a well behaved Observable implementation
shouldn't send any more onNext events.
A Subject
is a sort of bridge or proxy that acts both as an
Observer and as an Observable.
A Subject
is a sort of bridge or proxy that acts both as an
Observer and as an Observable. Because it is a Observer
,
it can to an Observable
and because it is an Observable
, it can pass through the
items it observes by re-emitting them and it can also emit new items.
Cancelables represent asynchronous units of work or other things scheduled for execution and whose execution can be canceled.
Cancelables represent asynchronous units of work or other things scheduled for execution and whose execution can be canceled.
One use-case is the scheduling done by monifu.concurrent.Scheduler, in which
the scheduling methods return a Cancelable
, allowing the canceling of the
scheduling.
Example:
val s = ConcurrentScheduler() val task = s.scheduleRepeated(10.seconds, 50.seconds, { println("Hello") }) // later, cancels the scheduling ... task.cancel()
A channel is meant for imperative style feeding of events.
When emitting events, one doesn't need to follow the back-pressure contract. On the other hand the grammar must still be respected:
(pushNext)* (pushComplete | pushError)