Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to invoke the MessagePump Circuitbreaker #443

Open
fgheysels opened this issue Jun 26, 2024 · 3 comments
Open

Unable to invoke the MessagePump Circuitbreaker #443

fgheysels opened this issue Jun 26, 2024 · 3 comments

Comments

@fgheysels
Copy link
Member

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.

image

@stijnmoreels
Copy link
Member

Think this will be resolved with #442

@fgheysels
Copy link
Member Author

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.

@stijnmoreels
Copy link
Member

Yes, saw that too - am working on your branch to fully use the message receiver instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants