Interesting.  What is the difference between the values give in the node 
x-declare block and the link x-declare block?  They both refer to values used 
in queueDeclare, but it seems like they are not equivalent.

The example did not work as given, but I'm working with it to try to figure out 
the right combination of node and link x-declare statements to make it work.

On Apr 25, 2011, at 1:58 AM, Jakub Scholz wrote:

> Hi David,
> 
> I believe you are looking for an address similar to this:
> 
> amq.topic/foo.#; {create: receiver, link: {name: 'foo_reciver_queue' ,
> x-declare: { auto-delete: true, exclusive: false } } }
> 
> It binds the topic exchange to a queue created by the receiver and
> named foo_receiver_queue using the key foo.#. This queue is created as
> auto-delete non-exclusive queue. You may want to change the queue
> parameters according to your needs. But you have to keep the
> exclusive: false parameter, else you will be unable to create multiple
> receivers on this queue.
> 
> I guess the getName() method of the receiver probably returns just
> some receiver name, not the queue name.
> 
> Hope it helps ...
> 
> Regards
> JAkub
> 
> On Sun, Apr 24, 2011 at 22:18, David Hawthorne <[email protected]> wrote:
>> I'm attempting to use the 0.8 messaging API and I don't see a way to specify 
>> the name of the queue to create or listen to using this API.  With the older 
>> API I could declare the queue with a known name, and thus have multiple 
>> clients draining the same queue using the same binding (round-robin consumer 
>> pattern).  It doesn't look like I can get the name of the queue created by 
>> createReceiver using Receiver.getName, either, because it only returns the 
>> name of the exchange.  e.g., if I have an exchange named "test", and I 
>> create a receiver with an address like "test/foobar.#; { create: always }", 
>> Receiver.getName() returns "test", whereas qpidd -t shows me the queue is 
>> actually "test_e54e7eff-3ae8-4508-b23a-0a0d8b2ef65f".
>> 
>> This almost leads me to the conclusion that it is not meant to be possible 
>> to round-robin pop messages off of a queue created on a topic exchange.  Is 
>> that the case?
>> 
>> code example:
>> 
>> {
>>                string queue_address = "test/foo.# ; { create: always, 
>> delete: always, node:{ type: topic, durable: false }}";
>> 
>>                qpid::messaging::Connection connection("127.0.0.1:5672");
>>                connection.open();
>>                qpid::messaging::Session session = connection.createSession();
>>                qpid::messaging::Receiver receiver = 
>> session.createReceiver(queue_address);
>> 
>>                // attempt to create a second receiver listening on the same 
>> queue to see what happens
>>                qpid::messaging::Receiver receiver2 = 
>> session.createReceiver(queue_address);
>> 
>>                cout << "receiver name is " << receiver.getName() << endl;
>>                cout << "receiver2 name is " << receiver2.getName() << endl;
>> 
>>                qpid::messaging::Message message;
>>                qpid::messaging::Duration timeout = 
>> qpid::messaging::Duration::SECOND;
>> 
>>                int messages_received = 0;
>> 
>>                while (receiver.fetch(msg, timeout))
>>                        messages_received++;
>> 
>>                while (receiver2.fetch(msg, timeout))
>>                        messages_received++;
>> 
>>                cout << "total messages received is " << messages_received << 
>> endl;
>> }
>> 
>> receiver name is test
>> receiver2 name is test_2
>> total messages received is 4, expected 2
>> 
>> I keep a count of the total messages received from all receivers, and I'm 
>> sending exactly 2 messages.  The total messages received should equal 2, but 
>> in this case it equals 4 because each receiver creates a new queue with a 
>> unique name and the messages are delivered to each of those, effectively 
>> preventing the round-robin capability of the old API.
>> 
>> Any help you can give would be greatly appreciated.
>> ---------------------------------------------------------------------
>> Apache Qpid - AMQP Messaging Implementation
>> Project:      http://qpid.apache.org
>> Use/Interact: mailto:[email protected]
>> 
>> 
> 
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:[email protected]
> 


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to