activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jose Luna <>
Subject Re: question about queue or topic and clients
Date Sat, 25 Jul 2009 12:31:44 GMT

> thanks for your reply,the message that i want to  send to clients is
> different,that is to say
> i want to tell one client a message.if i have only one topic ,every
> client  must jude the message weather is sent to himself. do you have
> good idea?

If each client is getting it's own messages, then I suggest each client have it's own queue.
 If there is overlap in the messages, then another option is to have a single queue and have
all the clients connect with selectors (  

> I think you should use one topic, otherwise, your procedure have to send one
> message for 500 times to each topic.

Actually, using composite queues (
you can send one message and have it automatically forwarded to all 500 destinations.  For
example, let's say that we have a queue named "prices". You can have these forwarded to composite
queues of the form "CompositeQueue.*.prices". 

Each client can then connect to the queue: CompositeQueue.CLIENT_UNIQUE_ID.prices .  All messages
to "prices" will be forwarded to these composite queues.  This has the added benefit that
you can also send a message directly to a client using the composite queue name, if the need
arises.  Moreover, this allows the client to act as a durable topic subscriber, since the
messages will be forwarded to existing composite queues regardless of whether or not the client
is connected when the message is sent.  Finally, note that you can also use selectors on the
composite queues themselves.

Given that you have queues, topics, virtual destinations, and selectors at your disposal,
there are many different ways to solve the same problem.  It's best to read up on all of these
features and play around with them, so that you can get a better understanding of their pros
and cons.



View raw message