rabbitmq-server icon indicating copy to clipboard operation
rabbitmq-server copied to clipboard

Server-named queues are left behind

Open ThomasBaechlerConti opened this issue 5 years ago • 11 comments

I am implementing applications that communicate purely using AMQP 1.0. While I want to use RabbitMQ as AMQP broker, the applications are unaware of rabbitmq entirely.

I use a fanout exchange in RabbitMQ to deliver broadcast messages to all clients. To do so, I subscribe to the AMQP address /exchange/<name of exchange>. This creates a new queue in RabbitMQ and binds it to the correct exchange. So far, this works and messages arrive at all clients.

However, once a client disconnects, that queue stays around. According to rabbitmq/rabbitmq-amqp1.0#22, this seems intentional, but I don't understand the reasoning:

  • Since the queue's name is auto-generated, nobody has the queue name and reconnecting to the queue is impossible.
  • Even when the same client reconnects, a new queue is generated.
  • The generated queue fills up with messages that will never be received, since nobody will ever connect to it again.
  • The queues disappear when RabbitMQ is restarted.

IMO, these queues should be auto-delete. What is the reason that they are not?

ThomasBaechlerConti avatar Jul 08 '19 11:07 ThomasBaechlerConti

Ok so this is for the case where your destination address does not have a queue name segment, e.g. "/exchange/myexchange/" vs "/exchange/myexchange/myqueue".

I think it is reasonable to make server named queues auto-delete. WDYT @dumbbell ?

kjnilsson avatar Jul 08 '19 11:07 kjnilsson

I am confused. According to the README:

"/exchange/"  X "/" RK  Consume from temp queue bound to X with routing key RK

I can specify the routing key here (which is not relevant for me), but this doesn't say I can give it a name for the queue. In fact, when I use that syntax, I still get a queue with a generated name ("amq.gen-RANDOM").

ThomasBaechlerConti avatar Jul 08 '19 11:07 ThomasBaechlerConti

my bad, you are quite right they are all server named queues here

kjnilsson avatar Jul 08 '19 12:07 kjnilsson

@ThomasBaechlerConti you have answered @kjnilsson's question. You shouldn't provide a name with that destination.

It makes sense to use auto-delete queues for that, maybe even exclusive ones.

michaelklishin avatar Jul 08 '19 12:07 michaelklishin

I agree, it makes sense to make them auto-delete queues.

dumbbell avatar Jul 08 '19 12:07 dumbbell

Hi,

I use AMQP 1.0 and have exactly this problem. Is there any update? For our company it is a bug "yes or no" when it comes to RabbitMQ and AMQP 1.0 that there is active support. At the moment it feels like AMQP 1.0 support is dropped because every ticket I found is 1 to 2 years old and never touched.

PassionateDeveloper86 avatar Jun 20 '21 17:06 PassionateDeveloper86

Hi, I am having exactly the same issue and I would like to either be able to provide meaningfull queue names and then be able to reconnect to that specific queue or just set it to auto-delete.

Any prospect on fixing this?

jrk94 avatar Aug 12 '21 09:08 jrk94

Similar concerns here. Is there nothing I can do from the (AMQP 1.0) client side to instruct RabbitMQ to use auto-delete?

petertiedemann avatar Feb 15 '22 19:02 petertiedemann

This is open source software. Asking others to "fix this" is not how open source works.

Queues can be configured to have a TTL regardless of the client or protocol used.

michaelklishin avatar Feb 16 '22 11:02 michaelklishin

This is open source software. Asking others to "fix this" is not how open source works.

I assume this remark was directed at @jrk94 and/or @PassionateDeveloper86? Because I was not asking for a fix, I was asking about options.

Queues can be configured to have a TTL regardless of the client or protocol used.

So the solution here is to specify a TTL for "amq.gen*" ?

petertiedemann avatar Feb 16 '22 12:02 petertiedemann

Applying TTL to ^amq\.gen should do it (but will affect all server-named queues, of course).

michaelklishin avatar Feb 16 '22 21:02 michaelklishin