Question

By default, it appears MassTransit is using transient exchanges. I see there is a durable switch in both the DeclareExchange and BindQueue methods here:

https://github.com/phatboyg/MassTransit/blob/217d51b9d6ea19d5b01904dcceb7bacd399ace67/src/Transports/MassTransit.Transports.RabbitMq/RabbitMqConnection.cs

I hoping this would be somewhat easy... Similar to EasyNetQ, where you can access the advanced bus properties, toggle the durable flag, and you are done...

I am not, however, finding where you can actually access the RabbitMqConnection object in the bus configurations, and call these methods.

Anyone happen to have an example of how to use the DeclareExchange method?

Update: The default behavior is in fact durable. The issue was due to an unsubscribe.

Was it helpful?

Solution

All exchanges and queues are durable by default, including any bindings between exchanges.

The only non-durable exchanges are those that are bound to publish events that are private classes, those are declared as temporary to avoid cluttering the virtual host with a bunch of internal/private class names and bindings once the connection is closed.

The only other way is if the address URI includes:

?temporary=true

In which case, it will declare it as temporary. This is often used when a temporary queue/exchange/binding is required for a transient consumer that goes away once the process is exited.

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