I am trying to understand how to unsubscribe from an Observable that is created from a live feed.
Here is more or less the code:
SomeFeed feed = new SomeFeed();
Observable<PriceTick> observable = Observable.create(s ->
feed.register(new SomeListener() {
@Override
public void priceTick(PriceTick event) {
s.onNext(event);
}
@Override
public void error(Throwable throwable) {
s.onError(throwable);
}
})
);
Subscription subscription = observable.subscribe(System.out::println);
subscription.unsubscribe();
System.out.println("Is unsubscribed:" + subscription.isUnsubscribed()); // prints true
I am finding that after the subscription is unsubscribed, the subscribed is still outputting the event stream.
How can I get the unsubscribe to remove the subscriber from the notifications?
I am trying to understand how to unsubscribe from an Observable that is created from a live feed.
Here is more or less the code:
I am finding that after the subscription is unsubscribed, the subscribed is still outputting the event stream.
How can I get the unsubscribe to remove the subscriber from the notifications?