arcus-azure / arcus.messaging

Messaging with Microsoft Azure in a breeze.
https://messaging.arcus-azure.net
MIT License
20 stars 11 forks source link

Implement circuit-breaker functionality #415

Closed fgheysels closed 12 months ago

fgheysels commented 1 year ago

Is your feature request related to a problem? Please describe. When you have a message-handler that has a dependency on an external resource, that resource might become unavailable and in that case we want to temporarily stop processing messages.
For this, we can use the MessagePumpLifeCycle which is already available in Arcus.Messaging.

However, I'd like to avoid that once the 'pause-time' has elapsed, we start processing a whole bunch of messages again. It would be better to try processing messages at a slower rate and only once the downstream-dependency is fully functional again, we can resume with processing larger batches.

Describe the solution you'd like The circuit breaker pattern is described here. The 'half-open' state is particularly interesting.

Can we implement this by building further on the MessagePumpLifeCycle ?
Just some random thoughts:

stijnmoreels commented 1 year ago

This looks like a cool feature, but some further investigation will be required indeed to look for the possibilities. We could use the current 'life-cycle' functionality, but then we should 'start fresh' with a new interface and deprecate this old one for backwards compatibility.

stijnmoreels commented 1 year ago

@fgheysels Also a point worth noting: this is a feature of the pump (receiver) not of the processor (router), so it will not be available for Azure Functions applications as in those cases the Trigger acts as the receiver.

fgheysels commented 1 year ago

@fgheysels Also a point worth noting: this is a feature of the pump (receiver) not of the processor (router), so it will not be available for Azure Functions applications as in those cases the Trigger acts as the receiver.

That's something that must be documented then. We cannot control the behavior of the ServiceBus Trigger in Functions

fgheysels commented 1 year ago

This looks like a cool feature, but some further investigation will be required indeed to look for the possibilities. We could use the current 'life-cycle' functionality, but then we should 'start fresh' with a new interface and deprecate this old one for backwards compatibility.

Or we increase the major version-number to make it clear that this is a breaking change ...