With RabbitMQ I am doing something similar to this:
channel.QueueDeclare(QueueName, true, false, false, null);
By default RabbitMQ creates a new queue if none of the existing matches the name provided. I would like to have an exception thrown instead. Is that possible?
Thanks
Step 1: Navigate to the RabbitMQ management portal, type your credentials and log in. Step 2: Go to the Queues tab, and click on the name of the Queue you want to delete. Step 3: After you’ve chosen the queue you want to delete, you’ll be taken to its detail page where you’ll find a delete or purge option towards the bottom of the list.
Queues in RabbitMQ are ordered collections of messages. Messages are enqueued and dequeued (consumed) in the FIFO manner, although priority queues, sharded queues and other features may affect this.
In RabbitMQ, a producer never sends a message directly to a queue. Instead, it uses an exchange as a routing mediator. Therefore, the exchange decides if the message goes to one queue, to multiple queues, or is simply discarded.
When RabbitMQ quits or crashes it will forget the queues and messages unless you tell it not to. Two things are required to make sure that messages aren't lost: we need to mark both the queue and messages as durable. First, we need to make sure that the queue will survive a RabbitMQ node restart.
Passive declarations are made for this. Use IModel.QueueDeclarePassive()
:
model.QueueDeclarePassive("queue-name");
This does nothing if the queue already exists, and raises an exception otherwise.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With