<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>Yogesh,</div><div><br></div><div>I don't believe there is a possibility of deadlock in this situation. It is</div><div>possible that the second client will declare the queue and that it is then</div><div>deleted (by the first client) before it can start using it, but no deadlock will</div><div>occur.</div><div><br></div><div>However, there is a window between Declaring a queue and it being 'in use'</div><div>(which means there is a Consumer subscribed), so that publishers that declare</div><div>before use, and consumers that declare before use, might have the queue removed</div><div>from them just when they don't want it removed.</div><div><br></div><div>The Consume will fail if the queue disappears, so some retry logic is all that</div><div>is needed on the Consumer client app.</div><div><br></div><div>Publishing to a non-existent queue is quite OK -- no failure there, so some</div><div>options on the publish would need to be employed to ensure that the message</div><div>reaches its destination.</div><div><br></div><div>I'm not sure what a fail-safe solution to the declare-publish window is, so I'll</div><div>ask my colleagues.</div><div><br></div><div>Hope this is useful,</div></div><div><div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="font-weight: normal; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div style="font-style: normal; "><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px; ">Steve Powell &nbsp;</span><span class="Apple-style-span" style="font-size: 11px; ">(<i>a loppy bunny</i>)</span></font></div></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 11px; "><div style="font-style: normal; font-family: Helvetica; font-size: 12px; "><i><font class="Apple-style-span" face="Georgia" size="2"><span class="Apple-style-span" style="font-size: 10px; ">----------some more definitions from the SPD----------</span></font></i></div><div style="font-family: Helvetica; font-size: 12px; "><font class="Apple-style-span" face="Georgia" size="2"><span class="Apple-style-span" style="font-style: normal; font-size: 10px; "><b>vermin</b>&nbsp;(</span><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px; "><i>v.</i>)</span></font><span class="Apple-style-span" style="font-style: normal; font-size: 10px; ">&nbsp;Treating the dachshund for roundworm.</span></font></div></span></font></div></div></div><span class="Apple-style-span" style="font-weight: normal; font-family: Helvetica; font-size: 12px; "><font class="Apple-style-span" face="Georgia" size="2" style="font-style: normal; "><span class="Apple-style-span" style="font-size: 10px; "><b>chinchilla</b>&nbsp;(</span></font><font class="Apple-style-span" face="Georgia" size="2"><span class="Apple-style-span" style="font-size: 10px; "><i>n.</i>) Cooling device for the lower jaw.</span></font></span><div><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Georgia; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "></span><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="font-family: Georgia; font-weight: normal; font-style: normal; font-size: 10px; "><b>socialcast</b></span><span class="Apple-style-span" style="font-family: Georgia; font-weight: normal; font-style: normal; font-size: 10px; ">&nbsp;(</span><span class="Apple-style-span" style="font-family: Georgia; font-weight: normal; font-size: 10px; "><i>n.</i>)</span><span class="Apple-style-span" style="font-family: Georgia; font-weight: normal; font-style: normal; font-size: 10px; ">&nbsp;Someone to whom everyone is speaking but nobody likes.</span></span></div></div>
</div>
<br><div><div>On 23 Jan 2012, at 14:33, Yogesh Ketkar wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Thanks Steve.<br><br>I am planning to write a Java Client which will get list of queues<br>using something like<br>Process proc = Runtime.getRuntime().exec("rabbitmqadmin.py list queues<br>name -f bash") and then iterate over each queue name<br>and call<br>channel1.queueDelete(queueName, true, true)<br><br>Just one question.<br>Assume that this client is trying to delete the queue on one channel<br>and and some other client is trying to do<br>channel2.queueDeclare as it wants to publish a message on the same<br>queue.<br>Is there a chance of deadlock due to timing of these 2 calls, on two<br>different channels, channel1.queueDelete and channel2.queueDeclare?<br><br>regards, Yogesh<br><br><br>On Jan 23, 5:23&nbsp;pm, Steve Powell &lt;st...@rabbitmq.com&gt; wrote:<br><blockquote type="cite">Yogesh,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">rabbitmqadmin can delete the queue but without the checks that it might not be<br></blockquote><blockquote type="cite">empty and might be being used. &nbsp;If you can be sure that the queue is dead, then<br></blockquote><blockquote type="cite">a rabbitmqadmin check followed by a delete would be quite adequate.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">However, if it is possible that the queue might not be dead (just usage being<br></blockquote><blockquote type="cite">slow) or it might be reused, then it is imperative that the delete be<br></blockquote><blockquote type="cite">conditional. &nbsp;The java client interface (or some other client interface) should<br></blockquote><blockquote type="cite">be used to make the delete conditional.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">We notice here that the rabbitmqadmin interface doesn't allow you to<br></blockquote><blockquote type="cite">conditionally delete. We have raised a bug to do this -- but in the meantime, I<br></blockquote><blockquote type="cite">would code a script that issues the rabbitmqadmin calls to determine which<br></blockquote><blockquote type="cite">queues to conditionally delete, and then invoke simple stand-alone client app to<br></blockquote><blockquote type="cite">do the conditional deletes. &nbsp; It's a bit klunky, but reasonably safe.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Hope this helps.<br></blockquote><blockquote type="cite">Steve Powell &nbsp;(a happy bunny)<br></blockquote><blockquote type="cite">----------some more definitions from the SPD----------<br></blockquote><blockquote type="cite">vermin (v.) Treating the dachshund for roundworm.<br></blockquote><blockquote type="cite">chinchilla (n.) Cooling device for the lower jaw.<br></blockquote><blockquote type="cite">socialcast (n.) Someone to whom everyone is speaking but nobody likes.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">On 22 Jan 2012, at 07:40, Yogesh Ketkar wrote:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">Thanks Steve and Simon.<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">I checked that rabbitmqadmin.py uses http calls (RESTful APIs)<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">provided by RabbitMQ to perform the operations.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Can you provide me a sample<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">- (either using rabbitmqadmin or using RESTful client) to delete a<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">queue say "Yogesh" with isEmpty and isUnused flags set to True?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">&nbsp;I could delete the queue using DELETE http request on<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><a href="http://localhost:55672/api/queues/%2f/Yogesh">http://localhost:55672/api/queues/%2f/Yogesh</a><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">&nbsp;But couldn't figure out a way to specify isEmpty and isUnused flags.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">- I was able to do this in a Java client using interface<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">com.rabbitmq.client.Channel { queueDelete("Yogesh", true, true) }.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">&nbsp;But then, how do I get list of queues using com.rabbitmq.client?<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">regards, Yogesh<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">On Jan 20, 7:25 pm, Steve Powell &lt;st...@rabbitmq.com&gt; wrote:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Just a thought,<br></blockquote></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">If you go the way Simon says and have something from outside poking the mgmt API<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">every few minutes, make sure you issue queueDelete with the if-empty bit set.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">There is a window between the poking and the deleting in which messages may<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">arrive on the queue (i.e. it's not idle anymore), and it may even not be in-use<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">(have consumers) by the time you get to it.<br></blockquote></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Steve Powell<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">st...@rabbitmq.com<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">[wrk:+44-2380-111-528begin_of_the_skype_highlighting&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+44-2380-111-528&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;begin_of_the_skype_highlighting &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+44-2380-111-528 &nbsp; &nbsp; &nbsp;] [mob:+44-7815-838-558begin_of_the_skype_highlighting&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+44-7815-838-558&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;begin_of_the_skype_highlighting &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+44-7815-838-558 &nbsp; &nbsp; &nbsp;]<br></blockquote></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">On 20 Jan 2012, at 12:47, Simon MacMullen wrote:<br></blockquote></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">On 16/01/12 15:56, Yogesh Ketkar wrote:<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">I would like to delete the queue with no messages in it and so asked<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">the question.<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">I see.<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Can you suggest an alternative to achieve<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">1. Delete the queue when last event processed from the queue has<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">&lt;Action&gt;Delete&lt;/Action&gt; &nbsp;as this implies that<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">&nbsp; &nbsp;no more events with same&lt;AppId&gt; &nbsp;would ever get created.<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Well, you could have your client do that.<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">2. Delete the queue when it is IDLE for certain period, meaning it is<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">empty and no more event was added to it for certain time period.<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">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.)<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">rabbitmqadmin list queues name messages consumers idle_since<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Cheers, Simon<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">--<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Simon MacMullen<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">RabbitMQ, VMware<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">_______________________________________________<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">rabbitmq-discuss mailing list<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">rabbitmq-disc...@lists.rabbitmq.com<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">_______________________________________________<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">rabbitmq-discuss mailing list<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">rabbitmq-disc...@lists.rabbitmq.comhttps://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">_______________________________________________<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">rabbitmq-discuss mailing list<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">rabbitmq-disc...@lists.rabbitmq.com<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">_______________________________________________<br></blockquote><blockquote type="cite">rabbitmq-discuss mailing list<br></blockquote><blockquote type="cite">rabbitmq-disc...@lists.rabbitmq.comhttps://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discussTh<br></blockquote>_______________________________________________<br>rabbitmq-discuss mailing list<br><a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br><a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br></div></blockquote></div><br></div></body></html>