zarusz / SlimMessageBus

Lightweight message bus interface for .NET (pub/sub and request-response) with transport plugins for popular message brokers.
Apache License 2.0
467 stars 78 forks source link

[Core] Incorporate CancellationToken and/or IConsumerContext to the Consumer interfaces #246

Closed zarusz closed 3 months ago

zarusz commented 5 months ago

Current state We can get ahold of the CancellationToken and IConsumerContext by:

Problem The current state in 2.x does not promote the use of CancellationToken-s and requires users to make an extra step to bring that into the consumers.

Proposal Add the CancellationToken and/or IConsumerContext to the core IConsumer<T> / IRequestHandler<T, R> interfaces.

Backward compatibility consideration Is it worth doing it backward compatible (new interface and old would be maintained)? The benefit is that users could easily update the library. On the other hand it might be okay to break the interface (not much updates for users). We would do this as part of 3.x release.

zarusz commented 3 months ago

This is now incorporated into 3.0.0-rc1