TBD
TBD
The various RxGroovy implementations of Start are found in the
optional rxjava-async
module.
The rxjava-async
module also includes the runAsync
operator. It is
peculiar in that it creates a specialization of an Observable called a
StoppableObservable
.
Pass runAsync
an Action
and a
Scheduler
, and it will
return a StoppableObservable
that uses the specified Action
to
generate items that it emits. The Action
accepts an Observer
and a
Subscription
. It uses the Subscription
to check for the
unsubscribed
condition, upon which it will stop emitting items. You can also
manually stop a StoppableObservable
at any time by calling its
unsubscribe
method (which will also unsubscribe the Subscription
you
have associated with the StoppableObservable
).
Because runAsync
immediately invokes the Action
and begins emitting
the items (that is, it produces a hot Observable), it is possible that some items may
be lost in the interval between when you establish the StoppableObservable
with
this operator and when your Observer
is ready to receive items. If this is a
problem, you can use the variant of runAsync
that also accepts a
Subject
and pass a ReplaySubject
with which you can retrieve the
otherwise-missing items.
In RxGroovy there is also a version of the
From operator that converts a
Future
into an Observable, and in this way resembles the
Start operator.
The various RxJava implementations of Start are found in the
optional rxjava-async
module.
The rxjava-async
module also includes the runAsync
operator. It is
peculiar in that it creates a specialization of an Observable called a
StoppableObservable
.
Pass runAsync
an Action
and a
Scheduler
, and it will
return a StoppableObservable
that uses the specified Action
to
generate items that it emits. The Action
accepts an Observer
and a
Subscription
. It uses the Subscription
to check for the
unsubscribed
condition, upon which it will stop emitting items. You can also
manually stop a StoppableObservable
at any time by calling its
unsubscribe
method (which will also unsubscribe the Subscription
you
have associated with the StoppableObservable
).
Because runAsync
immediately invokes the Action
and begins emitting
the items (that is, it produces a hot Observable), it is possible that some items may
be lost in the interval between when you establish the StoppableObservable
with
this operator and when your Observer
is ready to receive items. If this is a
problem, you can use the variant of runAsync
that also accepts a
Subject
and pass a ReplaySubject
with which you can retrieve the
otherwise-missing items.
In RxJava there is also a version of the
From operator that converts a
Future
into an Observable, and in this way resembles the
Start operator.
TBD
TBD