Using this code:
Disposable d =
Flowable.range(1, 5)
.subscribeWith(new DisposableSubscriber<Integer>() {
@Override
public void onStart() {
request(1);
}
@Override
public void onNext(Integer t) {
if (t == 3) {
cancel();
}
System.out.println(t);
request(1);
}
@Override
public void onError(Throwable t) {
t.printStackTrace();
}
@Override
public void onComplete() {
System.out.println("Done!");
}
});
will print
1
2
3
If you cancel/dispose a subscription, onComplete
is never called, neither is onError
. Is this the correct behavior?
Is there an event called onDispose()
or some way to know where the subscription is disposed ?