Open fgheysels opened 5 months ago
Think this will be resolved with #442
This remark on the ProcessMessageAsync
event is actually a bit worrying
///
/// It is not recommended that the state of the processor be managed directly from within this handler; requesting to start or stop the processor may result in /// a deadlock scenario. ///
Because, that's what we're actually doing... When we call the circuitbreaker from within the ProcessMessageAsync eventhandler, we're actually stopping the processor.
Yes, saw that too - am working on your branch to fully use the message receiver instead.
I have a project where I use Arcus.Messaging and where I make use of the new Circuitbreaker functionality.
During testing, I've noticed that the Circuitbreaker functionality doesn't kick in when requested. Logs of my application show this exception:
This can be traced back to the
StopProcessingMessagesAsync
method of theAzureServiceBusMessagePump
class. Apparently this exception is thrown in that try-block.Further investigation showed that the stacktrace contains a reference to a method
EnsureNotRunningAndInvoke
which is a member method ofServiceBusProcessor
class.Looking at that code shows that the logic for removing an eventhandler on the
ProcessMessageAsync
andProcessErrorAsync
methods are calling this method. clickThis means that the
StopProcessingMessagesAsync
method must first call theStopProcessingAsync
method on theServiceBusProcessor
before removing the eventhandlers.