You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Marcelo Vieira <ma...@digirati.com.br> on 2013/12/06 16:43:22 UTC

How to create an exclusive queue?

Is there a way to create a new and exclusive queue that accepts only one 
session at a time? I'm trying to use 'qpid-config' command for this, is 
there any parameter to do that?

I tried using the configuration x-declare: {auto-delete: false, 
exclusive: true} in the creation of the session, but it seems to have 
had no result

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: How to create an exclusive queue?

Posted by Marcelo Vieira <ma...@digirati.com.br>.
On 10-12-2013 20:46, Ted Ross wrote:
>
> On 12/10/2013 05:54 AM, Gordon Sim wrote:
>> On 12/09/2013 06:50 PM, Marcelo Vieira wrote:
>>> On 09-12-2013 16:22, Gordon Sim wrote:
>>>> On 12/09/2013 06:18 PM, Marcelo Vieira wrote:
>>>>>
>>>>> In the script running as a daemon that read the messages, I'm using
>>>>> 'my_queue; {create:always, link:{x-subscribe:{exclusive:true}}}'
>>>>>
>>>>> The senders are using the address: "my_queue; {node: {type: 
>>>>> queue}}" on
>>>>> the method createReceiver to open the session with the broker.
>>>>
>>>> Why are they calling createReceiver()?
>>>>
>>> Sorry, I made a mistake. They call createSender().
>>>
>>>>> When I execute the sender script, I get a message like this: "Error
>>>>> while sending broker message. resource-locked: resource-locked: Queue
>>>>> my_queue has an exclusive consumer. No more consumers allowed.
>>>>> (qpid/broker/Queue.cpp:414)"
>>>>
>>>> This sounds like it is working as expected, it is preventing further
>>>> consumers. The question is where those other consumers are coming 
>>>> from...
>>>>
>>> Yes, but this is preventing senders also.
>>
>> You are getting the error above when calling createSender()? What 
>> version are you using?
Yeah, the error ocurred when calling createSender(). I'm using the 0.14 
version of qpid.

In another test I performed, when I created a new queue e started the 
daemon, I noticed that even after the stop of the daemon I was unable to 
make a new connection with neither sender or receiver. I was getting the 
error message of resource-locked all the time, and no other consumer has 
been started.

It was only possible to recreate senders or receivers after removing the 
queue and create it again. Is there a way to close all active 
connections or monitor the consumers?

>
> Is it possible that you are attempting to create the sender after 
> having failed to create a receiver on the same session?  In AMQP 0-10, 
> session failures are "sticky".  Any subsequent operation on the 
> session will result in the reporting of the original error.
>
>>
>> I've tried consuming (using drain example) with 'my-queue; 
>> {create:always, link:{x-subscribe:{exclusive:True}}}' and sending 
>> (with spout example) using 'my-queue; {node: {type: queue}}' against 
>> brokers from 0.22, 0.24 and trunk and can't reproduce any errors.
>>
>> I think there must somehow be some other consumer. The error above 
>> comes from a path where consumption is set up.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
>> For additional commands, e-mail: users-help@qpid.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: How to create an exclusive queue?

Posted by Ted Ross <tr...@redhat.com>.
On 12/10/2013 05:54 AM, Gordon Sim wrote:
> On 12/09/2013 06:50 PM, Marcelo Vieira wrote:
>> On 09-12-2013 16:22, Gordon Sim wrote:
>>> On 12/09/2013 06:18 PM, Marcelo Vieira wrote:
>>>>
>>>> In the script running as a daemon that read the messages, I'm using
>>>> 'my_queue; {create:always, link:{x-subscribe:{exclusive:true}}}'
>>>>
>>>> The senders are using the address: "my_queue; {node: {type: 
>>>> queue}}" on
>>>> the method createReceiver to open the session with the broker.
>>>
>>> Why are they calling createReceiver()?
>>>
>> Sorry, I made a mistake. They call createSender().
>>
>>>> When I execute the sender script, I get a message like this: "Error
>>>> while sending broker message. resource-locked: resource-locked: Queue
>>>> my_queue has an exclusive consumer. No more consumers allowed.
>>>> (qpid/broker/Queue.cpp:414)"
>>>
>>> This sounds like it is working as expected, it is preventing further
>>> consumers. The question is where those other consumers are coming 
>>> from...
>>>
>> Yes, but this is preventing senders also.
>
> You are getting the error above when calling createSender()? What 
> version are you using?

Is it possible that you are attempting to create the sender after having 
failed to create a receiver on the same session?  In AMQP 0-10, session 
failures are "sticky".  Any subsequent operation on the session will 
result in the reporting of the original error.

>
> I've tried consuming (using drain example) with 'my-queue; 
> {create:always, link:{x-subscribe:{exclusive:True}}}' and sending 
> (with spout example) using 'my-queue; {node: {type: queue}}' against 
> brokers from 0.22, 0.24 and trunk and can't reproduce any errors.
>
> I think there must somehow be some other consumer. The error above 
> comes from a path where consumption is set up.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: How to create an exclusive queue?

Posted by Gordon Sim <gs...@redhat.com>.
On 12/09/2013 06:50 PM, Marcelo Vieira wrote:
> On 09-12-2013 16:22, Gordon Sim wrote:
>> On 12/09/2013 06:18 PM, Marcelo Vieira wrote:
>>>
>>> In the script running as a daemon that read the messages, I'm using
>>> 'my_queue; {create:always, link:{x-subscribe:{exclusive:true}}}'
>>>
>>> The senders are using the address: "my_queue; {node: {type: queue}}" on
>>> the method createReceiver to open the session with the broker.
>>
>> Why are they calling createReceiver()?
>>
> Sorry, I made a mistake. They call createSender().
>
>>> When I execute the sender script, I get a message like this: "Error
>>> while sending broker message. resource-locked: resource-locked: Queue
>>> my_queue has an exclusive consumer. No more consumers allowed.
>>> (qpid/broker/Queue.cpp:414)"
>>
>> This sounds like it is working as expected, it is preventing further
>> consumers. The question is where those other consumers are coming from...
>>
> Yes, but this is preventing senders also.

You are getting the error above when calling createSender()? What 
version are you using?

I've tried consuming (using drain example) with 'my-queue; 
{create:always, link:{x-subscribe:{exclusive:True}}}' and sending (with 
spout example) using 'my-queue; {node: {type: queue}}' against brokers 
from 0.22, 0.24 and trunk and can't reproduce any errors.

I think there must somehow be some other consumer. The error above comes 
from a path where consumption is set up.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: How to create an exclusive queue?

Posted by Marcelo Vieira <ma...@digirati.com.br>.
On 09-12-2013 16:22, Gordon Sim wrote:
> On 12/09/2013 06:18 PM, Marcelo Vieira wrote:
>>
>> In the script running as a daemon that read the messages, I'm using
>> 'my_queue; {create:always, link:{x-subscribe:{exclusive:true}}}'
>>
>> The senders are using the address: "my_queue; {node: {type: queue}}" on
>> the method createReceiver to open the session with the broker.
>
> Why are they calling createReceiver()?
>
Sorry, I made a mistake. They call createSender().

>> When I execute the sender script, I get a message like this: "Error
>> while sending broker message. resource-locked: resource-locked: Queue
>> my_queue has an exclusive consumer. No more consumers allowed.
>> (qpid/broker/Queue.cpp:414)"
>
> This sounds like it is working as expected, it is preventing further 
> consumers. The question is where those other consumers are coming from...
>
Yes, but this is preventing senders also.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: How to create an exclusive queue?

Posted by Gordon Sim <gs...@redhat.com>.
On 12/09/2013 06:18 PM, Marcelo Vieira wrote:
>
> In the script running as a daemon that read the messages, I'm using
> 'my_queue; {create:always, link:{x-subscribe:{exclusive:true}}}'
>
> The senders are using the address: "my_queue; {node: {type: queue}}" on
> the method createReceiver to open the session with the broker.

Why are they calling createReceiver()?

> When I execute the sender script, I get a message like this: "Error
> while sending broker message. resource-locked: resource-locked: Queue
> my_queue has an exclusive consumer. No more consumers allowed.
> (qpid/broker/Queue.cpp:414)"

This sounds like it is working as expected, it is preventing further 
consumers. The question is where those other consumers are coming from...

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: How to create an exclusive queue?

Posted by Marcelo Vieira <ma...@digirati.com.br>.
On 09-12-2013 16:07, Gordon Sim wrote:
> On 12/09/2013 05:51 PM, Marcelo Vieira wrote:
>>
>>> So actually a better suggestion might be, e.g.:
>>>
>>> 'my-queue; {create:always, link:{x-subscribe:{exclusive:True}}}'
>>>
>>> That should prevent anyone else consuming from it.
>>
>> Thanks, this way above worked, now only one client can consume the
>> queue, but it seems that it blocks other clients from sending messages
>> too.
>
> That should only be the case if the senders are using the exclusive 
> option also. (If that's not the case can you give a bit more detail on 
> the addresses you are using for the senders and the error you see?)

In the script running as a daemon that read the messages, I'm using 
'my_queue; {create:always, link:{x-subscribe:{exclusive:true}}}'

The senders are using the address: "my_queue; {node: {type: queue}}" on 
the method createReceiver to open the session with the broker.

When I execute the sender script, I get a message like this: "Error 
while sending broker message. resource-locked: resource-locked: Queue 
my_queue has an exclusive consumer. No more consumers allowed. 
(qpid/broker/Queue.cpp:414)"

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: How to create an exclusive queue?

Posted by Gordon Sim <gs...@redhat.com>.
On 12/09/2013 05:51 PM, Marcelo Vieira wrote:
>
>> So actually a better suggestion might be, e.g.:
>>
>> 'my-queue; {create:always, link:{x-subscribe:{exclusive:True}}}'
>>
>> That should prevent anyone else consuming from it.
>
> Thanks, this way above worked, now only one client can consume the
> queue, but it seems that it blocks other clients from sending messages
> too.

That should only be the case if the senders are using the exclusive 
option also. (If that's not the case can you give a bit more detail on 
the addresses you are using for the senders and the error you see?)

> In my scenario, I need the queue continue to receive messages from
> some clients, but only one should consume at the same time. Is there a
> way to do this?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: How to create an exclusive queue?

Posted by Marcelo Vieira <ma...@digirati.com.br>.
> So actually a better suggestion might be, e.g.:
>
> 'my-queue; {create:always, link:{x-subscribe:{exclusive:True}}}'
>
> That should prevent anyone else consuming from it.

Thanks, this way above worked, now only one client can consume the 
queue, but it seems that it blocks other clients from sending messages 
too. In my scenario, I need the queue continue to receive messages from 
some clients, but only one should consume at the same time. Is there a 
way to do this?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: How to create an exclusive queue?

Posted by Fraser Adams <fr...@blueyonder.co.uk>.
On 06/12/13 18:59, Darryl L. Pierce wrote:
> On Fri, Dec 06, 2013 at 06:15:52PM +0000, Gordon Sim wrote:
>> So actually a better suggestion might be, e.g.:
>>
>> 'my-queue; {create:always, link:{x-subscribe:{exclusive:True}}}'
> QQ - does create:always recreate the queue each time, even if it already
> exists?
>
No, if the queue already exists it is reused (and messages that have 
built up on it can be consumed).

One of the things I got bitten with when I first started using Qpid was 
when I created queues and bindings "on demand" via address strings. So 
If I had one binding and I changed it (say when I was tinkering around) 
what I ended up with was multiple bindings between exchange and queue :-)

I *think* that if I were to put my bindings in a "link" block, but keep 
the queue creation stuff in the node block that would have done what I'd 
expected, but TBH I've not actually tried that - I really should.

I think that in general it's good that the queue doesn't get recreated 
in the case you describe. In my scenario I'd like consumers to be able 
to create everything the first time that they connect, but if they then 
disconnect and reconnect I'd like any messages that have built up on the 
queue to remain.

Probably create:always is a bit misleading in this case, but I guess 
"create: mostly" probably sounds a bit weird :-D

I *think* that in the scenario that you illustrate above if you add 
autodelete:True then the queue will get deleted after the last 
connection closes and then recreated on the first new connection after that.

Frase

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: How to create an exclusive queue?

Posted by "Darryl L. Pierce" <dp...@redhat.com>.
On Fri, Dec 06, 2013 at 06:15:52PM +0000, Gordon Sim wrote:
> So actually a better suggestion might be, e.g.:
> 
> 'my-queue; {create:always, link:{x-subscribe:{exclusive:True}}}'

QQ - does create:always recreate the queue each time, even if it already
exists?

-- 
Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc.
Delivering value year after year.
Red Hat ranks #1 in value among software vendors.
http://www.redhat.com/promo/vendor/


Re: How to create an exclusive queue?

Posted by Gordon Sim <gs...@redhat.com>.
On 12/06/2013 05:52 PM, Marcelo Vieira wrote:
> Hi Gordon,
>
> Thanks for reply. I tried to do that anyway, but it seems that did not
> work. I have a script that runs as a daemon and creates a session to
> read messagens from a queue. Even with x-declare, other scripts can
> create sessions to read messages from the same queue, and I need to
> avoid this.

So they can consume from the queue even when the session would declared 
it as exclusive is still active? Can I ask what version of the server 
you are using?

> Is there some additional configuration required on the server to do this?

No, there shouldn't be. I did however forget to add in the 
'create:always' in the address. And if the queue already exists then the 
node properties would have no effect.

So actually a better suggestion might be, e.g.:

'my-queue; {create:always, link:{x-subscribe:{exclusive:True}}}'

That should prevent anyone else consuming from it.

(There are - confusingly - two distinct notions of exclusivity in AMQP 
0-10. The queue can be exclusive to a session or the consumer can 
request that it is the exclusive consumer0.

> On 06-12-2013 13:50, Gordon Sim wrote:
>> On 12/06/2013 03:43 PM, Marcelo Vieira wrote:
>>> Is there a way to create a new and exclusive queue that accepts only one
>>> session at a time? I'm trying to use 'qpid-config' command for this, is
>>> there any parameter to do that?
>>>
>>> I tried using the configuration x-declare: {auto-delete: false,
>>> exclusive: true} in the creation of the session, but it seems to have
>>> had no result
>>
>> You can't really do it from qpid-config. However you can add that
>> x-declare to the node properties of the addres you use to create the
>> sender/receiver/publisher/consumer, e.g
>>
>>   my-queue; {node:{x-declare: {auto-delete: false, exclusive: true}}}
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
>> For additional commands, e-mail: users-help@qpid.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: How to create an exclusive queue?

Posted by Marcelo Vieira <ma...@digirati.com.br>.
Hi Gordon,

Thanks for reply. I tried to do that anyway, but it seems that did not 
work. I have a script that runs as a daemon and creates a session to 
read messagens from a queue. Even with x-declare, other scripts can 
create sessions to read messages from the same queue, and I need to 
avoid this.

Is there some additional configuration required on the server to do this?

On 06-12-2013 13:50, Gordon Sim wrote:
> On 12/06/2013 03:43 PM, Marcelo Vieira wrote:
>> Is there a way to create a new and exclusive queue that accepts only one
>> session at a time? I'm trying to use 'qpid-config' command for this, is
>> there any parameter to do that?
>>
>> I tried using the configuration x-declare: {auto-delete: false,
>> exclusive: true} in the creation of the session, but it seems to have
>> had no result
>
> You can't really do it from qpid-config. However you can add that 
> x-declare to the node properties of the addres you use to create the 
> sender/receiver/publisher/consumer, e.g
>
>   my-queue; {node:{x-declare: {auto-delete: false, exclusive: true}}}
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: How to create an exclusive queue?

Posted by Gordon Sim <gs...@redhat.com>.
On 12/06/2013 03:43 PM, Marcelo Vieira wrote:
> Is there a way to create a new and exclusive queue that accepts only one
> session at a time? I'm trying to use 'qpid-config' command for this, is
> there any parameter to do that?
>
> I tried using the configuration x-declare: {auto-delete: false,
> exclusive: true} in the creation of the session, but it seems to have
> had no result

You can't really do it from qpid-config. However you can add that 
x-declare to the node properties of the addres you use to create the 
sender/receiver/publisher/consumer, e.g

   my-queue; {node:{x-declare: {auto-delete: false, exclusive: true}}}


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org