Particular / NServiceBus

Build, version, and monitor better microservices with the most powerful service platform for .NET
https://particular.net/nservicebus/
Other
2.1k stars 647 forks source link

Core and Transports rate-limiting options are "limited" #6447

Open danielmarbach opened 2 years ago

danielmarbach commented 2 years ago

Presently, NServiceBus offers very limited capability to rate-limit message processing. Probably the most commonly used API is LimitMessageProcessingConcurrencyTo which restricts the number of messages that can be handled concurrently. This is the only (*) setting that directly affects how the transport invokes the core.

For more advanced throttling, we have provided a sample

With the introduction of the new Rate-Limiting APIs for .NET System.Threading.RateLimiting which has net462, net6.0, net7.0, and netstandard2.0 assemblies it would be possible to have more sophisticated concurrency and rate-limiting control.

It would be great to experiment ways to get better integration with those APIs. For example providing downstream integration into those APIs in the transports, create a core seam that allows to pass RateLimitingPolicies/Options similar to the ASP.NET Core middleware that then is passed to the transport seam or just create samples

(*) Not entirely true since we also have the possibility now to go from N to 1 with the sequential processing

danielmarbach commented 2 years ago

// cc @timbussmann @bording @awright18

kbaley commented 2 years ago

Announcement about rate limiting package