user2249713
user2249713

Reputation: 35

Masstransit RabbitMq Request/Response cannot create auto-delete exchange

We are trying to implement a request/response scenario where the messages will be deleted server(consumer) is down. We start with no exchanges / queues in the rabbit mq installation.

There is a server which creates its own exchange / queue and we want this to be auto-delete=true.

In case the server is up before the client, the exchange is created with the correct configuration. But when the client is up we get this error:

RabbitMQ.Client.Exceptions.OperationInterruptedException: The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=406, text="PRECONDITION_FAILED - inequivalent arg 'auto_delete' for exchange 'simple_request' in vhost '****': received 'false' but current is 'true'", classId=40, methodId=10, cause=

In case the client is up first, and tries to send a message an exchange is created with the queue name that we have defined but it is not auto-delete=true which results to error:

RabbitMQ receive transport failed: The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=406, text="PRECONDITION_FAILED - inequivalent arg 'auto_delete' for exchange 'simple_request' in vhost '****': received 'true' but current is 'false'", classId=40, methodId=10, cause=RabbitMQ receive transport failed: The supervisor is stopping, no additional scopes can be created

when the server is eventually started.

How do we implement auto-delete queues in a request response scenario?

Upvotes: 3

Views: 1705

Answers (1)

Chris Patterson
Chris Patterson

Reputation: 33278

You can update the URI in your client for the service queue to include query string parameters so that the queue is created properly.

rabbitmq://host/vhost/queue?autodelete=true&durable=false

Note I included durable=false but that's only if you're using a non-durable queue and I wanted to be complete.

Upvotes: 0

Related Questions