Question

We're use MassTransit with RabbitMQ. Is there a way to check that endpoints aren't available before we publish any messages? I want to setup our IoC to use another strategy if servicebus isn't available and I don't want to get to the point when I'll catch RabbitMQ.Client.Exceptions.BrockerUnreachableException on publishing messages.

Was it helpful?

Solution 2

Not currently, you can submit an issue requesting that feature: https://github.com/MassTransit/MassTransit/issues. It's not trivial to implement, but maybe not impossible.

A couple of other options people have done include a remote cluster or having a local instance to forward/cluster across all machines included in the bus.

OTHER TIPS

If you're using a container, you could create a decorator that could monitor the outcome of the Publish method call, and if it starts throwing exceptions, you could switch the calls over to an alternative publisher.

Ideally such an implementation would include some type of progressive retry capability so that once the endpoint becomes available the calls resume back to the actual endpoint, as well as triggering some replay of the previously failed messages to the endpoint as well.

I figure you're already dealing with the need to have an alternative storage available, such as a local endpoint or some sort of local storage.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top