You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Kalle Kärkkäinen <ka...@intstream.fi> on 2009/04/03 14:24:28 UTC

Direct one-to-many

Hi,

I'm using M4 java and trunk cpp broker.

i'm experimenting with using direct exchange to do one to many communications, and I seem to get only one-to-one. It's rather random who get's the message.

I'm doing it like this:

session.exchangeDeclare("exchange", "direct", null, null, Option.DURABLE);

session.queueDeclare("queue", null, null, Option.AUTO_DELETE);
session.exchangeBind("queue", "exchange", "exchange.queue", null);

session.messageSubscribe("queue", "exchange", MessageAcceptMode.EXPLICIT, MessageAcquireMode.PRE_ACQUIRED, null, 0, null);

Is there some special dance I must do to get the one-to-many scheme going?

My messages are sent with routing key 'exchange.queue', and with one client on server it works ok, multiple clients, not so much.

I would very much so like to keep using amqp, as jms is not the target technology to learn here. I recognize that this probably work very well there.

--
Kalle.


Re: Direct one-to-many

Posted by Gordon Sim <gs...@redhat.com>.
Kalle Kärkkäinen wrote:
> ... Or is it so that I must make private queues, each attached to the 
> same exchange?

Yes; if each 'subscriber' creates it's own temporary queue (exclusive 
and auto-deleted) and binds that with the appropriate key then the 
message will end up in all matching queues.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Direct one-to-many

Posted by Kalle Kärkkäinen <ka...@intstream.fi>.
... Or is it so that I must make private queues, each attached to the same 
exchange?



----- Original Message ----- 
From: "Kalle Kärkkäinen" <ka...@intstream.fi>
To: <us...@qpid.apache.org>
Sent: Friday, April 03, 2009 3:24 PM
Subject: Direct one-to-many


Hi,

I'm using M4 java and trunk cpp broker.

i'm experimenting with using direct exchange to do one to many 
communications, and I seem to get only one-to-one. It's rather random who 
get's the message.

I'm doing it like this:

session.exchangeDeclare("exchange", "direct", null, null, Option.DURABLE);

session.queueDeclare("queue", null, null, Option.AUTO_DELETE);
session.exchangeBind("queue", "exchange", "exchange.queue", null);

session.messageSubscribe("queue", "exchange", MessageAcceptMode.EXPLICIT, 
MessageAcquireMode.PRE_ACQUIRED, null, 0, null);

Is there some special dance I must do to get the one-to-many scheme going?

My messages are sent with routing key 'exchange.queue', and with one client 
on server it works ok, multiple clients, not so much.

I would very much so like to keep using amqp, as jms is not the target 
technology to learn here. I recognize that this probably work very well 
there.

--
Kalle.



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org