[RabbitMQ 3.8.2 Erlang 22.2.7] Delete exclusive queues

221 views
Skip to first unread message

moutia el amrani

unread,
Mar 23, 2020, 1:41:07 PM3/23/20
to rabbitmq-users

Hello

We have some queues configured   as  Exclusive and auto-delete deletion.

Is it possible to auto delete these queues when consumers failed to send basic cancel (e.g. consumer crashed) ?

 

If so could you give us the right command please ?

 

 Regards

moutia el amrani

unread,
Mar 23, 2020, 1:46:09 PM3/23/20
to rabbitmq-users

We can’t use the auto-delete along with the TTL because we don't know the time of the tail consumption 

 


Luke Bakken

unread,
Mar 23, 2020, 8:19:46 PM3/23/20
to rabbitmq-users
Hello,

If a consumer crashes, its connection should be closed. At this point, an exclusive queue will be deleted. Is that not what you see in your environment? Can you provide code and instructions to reproduce?

Thanks -
Luke

moutia el amrani

unread,
Mar 24, 2020, 7:02:55 AM3/24/20
to rabbitm...@googlegroups.com
Hello Luck,

Our client is a standard client in C #, it complies with the RabbitMQ doc.

In the rabbitmq documentation it is marked that an auto-delete queue will not be deleted if:
• it didn't have a consumer - consuming with basic.get does not count as having a consumer
• the consumer failed to send basic.cancel (e.g. consumer crashed)


in our case we have some queues configured as Exclusive and auto-delete deletion and we can't auto delete theme =>
these queues consume a lot of memory

I tried to delete queues with these commands but are not deleted :

Command 1 : rabbitmqadmin --host=HOST --port=443 --ssl --vhost=VHOST --username=USERNAME --password=PASSWORD delete queue name=QUEUE_NAME
Result 1 : *** cannot obtain exclusive access to locked queue 'QUEUE_NAME' in vhost 'VHOST'. It could be originally declared on another connection or the exclusive property value does not match that of the original declaration.                                                  tion or the exclusive property value does not match that of the original declaration.

command 2 : rabbitmqctl eval '{ok, Q} = rabbit_amqqueue:lookup(rabbit_misc:r(<<"VHOST">>, queue, <<"QUEUE">>)), rabbit_amqqueue:delete_crashed(Q).'
Result 2 : remove queues: OK
but they are regenerated: why?
Question: error  in the command line?
is this the application that regenerates the queues?


If so could you give us the right command please ?

Regards
Moutia

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/4a2f2d16-7b18-41f9-a632-e84cabeae85c%40googlegroups.com.

Luke Bakken

unread,
Mar 24, 2020, 10:51:20 AM3/24/20
to rabbitmq-users
Hi Moutia,

Can you please share your code that declares your queue? I would like to know exactly how they are declared. Just describing it is not sufficient in this case.

Thanks,
Luke
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.

moutia el amrani

unread,
Mar 25, 2020, 5:17:40 AM3/25/20
to rabbitm...@googlegroups.com
Hello Luke,

please find attached  RabbitMQ client code

Regards
Moutia

Hi Moutia,
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/d6a9c3e9-5c78-46c7-8375-c4803db8871e%40googlegroups.com.
RabbitClient.cs

Luke Bakken

unread,
Mar 25, 2020, 12:12:02 PM3/25/20
to rabbitmq-users
Hello,

OK, you are declaring your queues as auto-delete. They are NOT exclusive so I don't know why you mentioned that in your messages.

If your application is running while you delete the queues it will probably re-declare them. This depends on how often RabbitClient is instantiated, which I can't tell from the code.

If you want to check, stop your application and see if the queues are deleted as according to the auto-delete rules. If they aren't auto-deleted (because they never had messages), delete them manually. They should not be re-created.

Thanks,
Luke
Reply all
Reply to author
Forward
0 new messages