[rabbitmq-discuss] Queue Lease (x-expires)

Steve Powell steve at rabbitmq.com
Mon Jan 23 12:23:43 GMT 2012


rabbitmqadmin can delete the queue but without the checks that it might not be
empty and might be being used.  If you can be sure that the queue is dead, then
a rabbitmqadmin check followed by a delete would be quite adequate.

However, if it is possible that the queue might not be dead (just usage being
slow) or it might be reused, then it is imperative that the delete be
conditional.  The java client interface (or some other client interface) should
be used to make the delete conditional.

We notice here that the rabbitmqadmin interface doesn't allow you to
conditionally delete. We have raised a bug to do this -- but in the meantime, I
would code a script that issues the rabbitmqadmin calls to determine which
queues to conditionally delete, and then invoke simple stand-alone client app to
do the conditional deletes.   It's a bit klunky, but reasonably safe.

Hope this helps.
Steve Powell  (a happy bunny)
----------some more definitions from the SPD----------
vermin (v.) Treating the dachshund for roundworm.
chinchilla (n.) Cooling device for the lower jaw.
socialcast (n.) Someone to whom everyone is speaking but nobody likes.

On 22 Jan 2012, at 07:40, Yogesh Ketkar wrote:

> Thanks Steve and Simon.
> I checked that rabbitmqadmin.py uses http calls (RESTful APIs)
> provided by RabbitMQ to perform the operations.
> Can you provide me a sample
> - (either using rabbitmqadmin or using RESTful client) to delete a
> queue say "Yogesh" with isEmpty and isUnused flags set to True?
>  I could delete the queue using DELETE http request on
> http://localhost:55672/api/queues/%2f/Yogesh
>  But couldn't figure out a way to specify isEmpty and isUnused flags.
> - I was able to do this in a Java client using interface
> com.rabbitmq.client.Channel { queueDelete("Yogesh", true, true) }.
>  But then, how do I get list of queues using com.rabbitmq.client?
> regards, Yogesh
> On Jan 20, 7:25 pm, Steve Powell <st... at rabbitmq.com> wrote:
>> Just a thought,
>> If you go the way Simon says and have something from outside poking the mgmt API
>> every few minutes, make sure you issue queueDelete with the if-empty bit set.
>> There is a window between the poking and the deleting in which messages may
>> arrive on the queue (i.e. it's not idle anymore), and it may even not be in-use
>> (have consumers) by the time you get to it.
>> Steve Powell
>> st... at rabbitmq.com
>> [wrk:+44-2380-111-528begin_of_the_skype_highlighting            +44-2380-111-528      ] [mob:+44-7815-838-558begin_of_the_skype_highlighting            +44-7815-838-558      ]
>> On 20 Jan 2012, at 12:47, Simon MacMullen wrote:
>>> On 16/01/12 15:56, Yogesh Ketkar wrote:
>>>> I would like to delete the queue with no messages in it and so asked
>>>> the question.
>>> I see.
>>>> Can you suggest an alternative to achieve
>>>> 1. Delete the queue when last event processed from the queue has
>>>> <Action>Delete</Action>  as this implies that
>>>>    no more events with same<AppId>  would ever get created.
>>> Well, you could have your client do that.
>>>> 2. Delete the queue when it is IDLE for certain period, meaning it is
>>>> empty and no more event was added to it for certain time period.
>>> Hmm. Well there's nothing built in to do this, but you could have something from outside poking the mgmt API every few minutes - look at the output of (e.g.)
>>> rabbitmqadmin list queues name messages consumers idle_since
>>> Cheers, Simon
>>> --
>>> Simon MacMullen
>>> RabbitMQ, VMware
>>> _______________________________________________
>>> rabbitmq-discuss mailing list
>>> rabbitmq-disc... at lists.rabbitmq.com
>>> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>> _______________________________________________
>> rabbitmq-discuss mailing list
>> rabbitmq-disc... at lists.rabbitmq.comhttps://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120123/85a4060e/attachment.htm>

More information about the rabbitmq-discuss mailing list