Skip to content

Publisher behavior after cancellation of Subscription? #113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Boereck opened this issue Sep 13, 2014 · 6 comments
Closed

Publisher behavior after cancellation of Subscription? #113

Boereck opened this issue Sep 13, 2014 · 6 comments

Comments

@Boereck
Copy link

Boereck commented Sep 13, 2014

Hello,

There seems to be no definition if a Publisher should notify a subscriber with onComplete or onError if the subscriber canceled the Subscribtion. Or should the Publisher silently accept the cancellation?
Did I overlook something or is there no defined behavior indeed?

Thanks,
Max

@Boereck
Copy link
Author

Boereck commented Sep 13, 2014

I just found the set of rules in the master, especially rule 6 and 8 apply. So maybe I can refine the question: Do calls of Subscription::cancel represent a request for cancellation that has to be acknowledged by the Publisher, or does the Publisher have to regard a Subscription canceled as soon as Subscription::cancel is called? If there has to be an acknowledgment, the question would be via onError or onComplete? My intuition would be onError, since the Publisher did not complete regularly.

@ktoso
Copy link
Contributor

ktoso commented Sep 13, 2014

Hi Max,
have a look at Rule 1.8 - after cancel() the Publisher should NOT signal onError nor onComplete, but this is not a "hard" requirement, because of the inherent race between signalling the cancelation and an in-flight OnComplete signal for example.

To answer your question directly - there is no need for the Publisher to "confirm that he got the cancellation", the Subscriber can start shutting down as soon as he's issued the cancelation. OnError and OnComplete are reserved for when the publisher terminates the Subscription.

@Boereck
Copy link
Author

Boereck commented Sep 13, 2014

Hi Konrad,
Thanks for the clarification! I was just unsure what "canceled" meant in the context of rule 1.8. So if Subscription::cancel() is called the Subscriber is regarded as canceled, and calls to onError() or onComplete() should not be done (apart from concurrent signals already on the way).

Thanks again,
Max

@Boereck Boereck closed this as completed Sep 13, 2014
@ktoso
Copy link
Contributor

ktoso commented Sep 13, 2014

Glad I could help!

Somewhat related: In case you're working on an implementation, you may be interested in the soon-to-be-merged TCK: #91

@Boereck
Copy link
Author

Boereck commented Sep 13, 2014

That will indeed be helpful. Thanks for pointing it out. I am working on a Publisher implementation only. I will run it against the relevant parts of the TCK, as soon as it is in the master.

@ktoso
Copy link
Contributor

ktoso commented Sep 13, 2014

Great, looking forward to it! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants