Skip to content
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

Add CancellationToken to IPublisher methods #116

Open
BEagle1984 opened this issue Jan 21, 2021 · 1 comment
Open

Add CancellationToken to IPublisher methods #116

BEagle1984 opened this issue Jan 21, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@BEagle1984
Copy link
Owner

BEagle1984 commented Jan 21, 2021

Task IPublisher.PublishAsync(object, CancellationToken)

The cancellation token would be passed to the subscribing methods that could declare an additional parameter of type CancellationToken.

public Task OnMessageReceived(MyCommand command, CancellationToken cancellationToken) { ... }

The mechanism could be used by the consumer as well, to signal the subscribers that the broker is disconnecting (maybe because the application is exiting) and the pending operations should be aborted.

(Thank you @mjeanrichard for the input.)

@BEagle1984
Copy link
Owner Author

Furthermore this CancellationToken could be forwarded to the Producer as well, to cancel the pending produce operation.

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

No branches or pull requests

1 participant