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

[Host] CancellationToken is not included as an OnHandle method paramter #223

Closed
EtherZa opened this issue Mar 29, 2024 · 2 comments
Closed
Assignees
Milestone

Comments

@EtherZa
Copy link
Contributor

EtherZa commented Mar 29, 2024

Neither IConsumer nor IRequestHandler include the CancellationToken associated with the message context as a method parameter.

It is accessible via IConsumerContext injection, but the implementation is not ideal as it breaks the facade of isolation from the message broker. Using setter injection also negates the ability to use a single consumer instance for concurrent processing.

@zarusz
Copy link
Owner

zarusz commented Mar 30, 2024

I agree in general, it would be better to have CancellationToken added as part of the consumer method.

There could also be an improvement added for concurrent consumers (.Instances(N) where N > 1) where the message processing pipeline would create N per-message scopes, rather than 1 nowadays.

In the long run, I was considering adding CancellationToken to the consumer methods in the future SMB v3. This perhaps would result in a breaking change to IConsumer<T>, or an additional interface that could be used.

I saw you have the PR for this feature using the consumer without the interface, which is a good middle-ground before v3.

@zarusz zarusz added this to the 2.3.0 milestone Mar 30, 2024
@zarusz
Copy link
Owner

zarusz commented Apr 2, 2024

Closed via #224

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

No branches or pull requests

2 participants