I'm unclear on how to implement task cancellation in RXJava.
I'm interested in porting an existing API built using Guava's ListenableFuture. My use case is as follows:
- I have an single operation that's composed of a sequence of futures joined by
Futures.transform() - Multiple subscribers observe the operation's final future.
- Each observer can cancel the final future, and all observers witness the cancellation event.
- Cancellation of the final future results in the cancellation of its dependencies, e.g. in sequence
1->2->3, cancellation of3is propagated to2, and so on.
There's very little info in the RxJava wiki about this; the only references I can find to cancellation mention Subscription as an equivalent to .NET's Disposable, but as far as I can see, Subscription only offers the ability to unsubscribe from subsequent values in the sequence.
I'm unclear on how to implement "any subscriber can cancel" semantics through this API. Am I thinking about this in the wrong way?
Any input would be appreciated.