Masstransit temporary queue

3.2k views Asked by At

I'm developing client application which use masstransit and rabbitmq. On application start I'm creating new queue with unique name for communication with server applications via masstransit(request/response model). On application closing I should delete this queue, but if client application crushes queue will present on rabbitmq.

Is it possible to create temporary queue via masstransit which rabbitmq will automatically delete when client disconnects from queue?

1

There are 1 answers

4
Chris Patterson On BEST ANSWER

You can create a temporary queue by using the ?temporary=true query string parameter.

With RabbitMQ, you can also dynamically create the queue name by using * as the queue name. Such as:

x.ReceiveFrom("rabbitmq://localhost/vhost/*?temporary=true");

This would create a temporary queue with a randomly generated name that is deleted when the connection is closed.