Closed EtherZa closed 5 months ago
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.
Closed via #224
Neither
IConsumer
norIRequestHandler
include theCancellationToken
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.