You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
System.InvalidOperationException: The message processor is already running and needs to be stopped in order to perform this operation
This can be traced back to the StopProcessingMessagesAsync method of the AzureServiceBusMessagePump 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 of ServiceBusProcessor class.
Looking at that code shows that the logic for removing an eventhandler on the ProcessMessageAsync and ProcessErrorAsync methods are calling this method. click
This means that the StopProcessingMessagesAsync method must first call the StopProcessingAsync method on the ServiceBusProcessor before removing the eventhandlers.
The text was updated successfully, but these errors were encountered:
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.
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.The text was updated successfully, but these errors were encountered: