RabbitMQ + dead letter exchange and autodelete - rabbitmq

Is there an option, to autodelete a queue if a dead-letter-exchange occurs?
I'm creating something like a scheduled tasks.
Eg:
I create a base worker-queue
then create helper queues with dead-letter-exchange
It routes the messages correctly to worker.
Now how to tell RabbitMQ to delete helper queues after they're used? Or do I have to delete them manually (using an another "garbage-collector" queue, for example)?

x-expires: <ms>
Is the solution. D'oh.

Related

Is re-declaring queue for every message can decrease the rabbitmq performance?

Is declaring queues for every message can decrease the rabbitmq performance?
We have a scenario in which we don't know the rabbitmq queue is exist or not. So declaring a queue for every message is a good approach?. Or we should check for each message the queue is exists or not?. Any alternate good approach.
You dont need to create queue on every message. When you start your consumer,
you will create connection and channel inside it. Once you had those set up, make your declare queue request.
I'd suggest one queue declaration per consumer's channel.
Look at official tutorials for your language. In each, you create connection, channel, declare queue once, and start doing your work.
Note: you don't need to declare a queue if you are running a producer. Producer sends messages to an exchange, and should not be aware of any queues.

Routing Dead-Lettered Messages

Is there a way in EasyNetQ to set the routing key [x-dead-letter-routing-key] argument when creating a Queue? (as far as I can see you can only set a DeadLetterExchange.)
IQueue updateCacheQueue = advancedBus.QueueDeclare(name: "UpdateCache", deadLetterExchange: "UpdatesDeadLetter");
RabbitMQ assumes that exchanges are superior to queues. You can create an exchange that delivers to exactly one queue, and thus your DLQ addressing issue is solved. Should you decide you need to take additional actions in the future (e.g. store the message for potential reprocessing AND ALSO alert operations via email), you can do that in the exchange without mucking up the queue processor.
I Added another parameter to the QueueDeclare method and created a pull request, and you can set it after version 0.40.6.355

How to find owner of queue in rabbitmq?

If I see some queue in rabbitmq (f.e. foobar), where is no activity, how I can find who created that queue, or, at least, which channel?
You can't find out creator except it was declared as exclusive and thus it has only one consumer.
Alternatively, you can find all channels (and thus connections) which utilize specific queue with management plugin.

Stopping consumers from consuming messages from queue

I am starting with ActiveMQ and I have a usecase. i have n producers sending messages into a Queue Q1. I want to stop the delivery of messages (i.e. i do not want consumers to consume those messages). I want to store the messages for sometime without those being consumed.
I was looking at ways this can be achieved. These two things came into my mind based on what i browsed through.
Using Mirrored queues, so that I can wiretap the messages and save into a virtual queue.
Possibly stop consumers from doing a PULL on the queue.
Another dirty way of doing this is by making consumers not send ack messages once its consumed a message from the queue.
We are currently not happy with either of these.
Any other way you can suggest.
Thanks in advance.
If you always want message delivery to be delayed you can use the scheduler feature of ActiveMQ to delay delivery until a set time or a fixed delay etc.
Other strategies might also work but it really up to you to design something that fits your use case. You can try to use Apache Camel to define a route that implements the logic of your use case to either dispatch a message to a Queue or send it to the scheduler for delayed processing. It all really depends on your use case and requirements.

KahaDBPersistenceAdapter and createQueueMessageStore

I am not sure if I need to call createQueueMessageStore for each queue that will be persisted, and it not, what is the purpose of this call ? Is setting the adapter on the broker enough without individual queueMessageStores ?
createQueueMessageStore() is used by the ActiveMQ Broker - you don't need to call this.
ActiveMQ automatically creates Queues and Topics on demand -
so if you send a message to a Queue foo.bar the ActiveMQ broker will check to see if it exists, and if it doesn't it will create it for you (using the createQueueMessageStore() call).