Closed fgheysels closed 12 months 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.
@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 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
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 ...
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:
MessagePumpLifeCycle
could keep track of counters that keep track of the amount of messages that have been processed (succesfully and failed). (I think it should be the responsability of the 'processor' to increment these properties; maybe via a method call on the MessagePumpLifeCycle which does that ?).MessagePumpLifeCycle
must be renamed toCircuitBreaker
(or something similar).