rabbitmqrebusrebus-rabbitmq

Can Rebus be configured to set error queue type to quorum in RabbitMQ?


We have a three node RabbitMq cluster and we are using Rebus to produce and consume messages from Rabbit. The messages that we handle are critical in terms of data safety so we use quorum queues in RabbitMq.

The problem right now is that we have a single point of failure even though we have a rabbit cluster; it occurs when the node that hosts the Rebus error queue becomes unavailable. There seems to be two options, either mirror the error queue in RabbitMQ or make the error queue a quorum queue.

I have found a way to set the input queue type to quorum:

Configure.With(activator)
                        .Logging(l => l.ColoredConsole())
                        .Transport(t =>
                            t.UseRabbitMq(
                                    "connectionString", "MyQueue")
                                .InputQueueOptions(queueConfig =>
                                {
                                    queueConfig.AddArgument("x-queue-type", "quorum");
                                }))                    
                        .Start();

Is there a way in Rebus to make the error queue a quorum queue as well? Is there a good reason for NOT having the error queue as a quorum queue and use mirroring instead?

Manually creating the error queue as a quorum queue in Rabbit doesnt work because Rebus complains that the queue type is not "classic".


Solution

  • Rebus.RabbitMq 7.2.0 has the ability to customize .DefaultQueueOptions(...) like you do with .InputQueueOptions(...) above – this means that your code can be extended to

    Configure.With(activator)
        .Logging(l => l.ColoredConsole())
        .Transport(t => 
            t.UseRabbitMq("connectionString", "MyQueue")
                .InputQueueOptions(queueConfig => queueConfig.AddArgument("x-queue-type", "quorum"))
                .DefaultQueueOptions(queueConfig => queueConfig.AddArgument("x-queue-type", "quorum"))
        )
        .Start();
    

    and thus achieve what you're after 🙂