On 11/03/2010 01:29 AM, [email protected] wrote:
I have read the example for pub-sub pattern. But it doesn't use Topic, it uses queues. What I want is to use a Topic for pub-sub. For example, if two subscribers subscribe on one queue, one message will only be delivered to one subscriber not both of them. How can I set up a Topic in old API?
The concept of a 'topic' as JMS defines it does not directly exist in AMQP 0-10. Rather it is constructed by creating an distinct exclusive subscription queue for each subscriber, binding that to an exchange and then subscribing to that queue. Messages published to this exchange then get routed to each subscription queue and thus each subscriber sees each message. The subscribers are not sharing a queue, they each have their own queue.
When you use the Qpid JMS client, and you use a Topic, it is doing this work for you. The broker doesn't see a topic being used, it sees a queue created for each subscriber and then being bound to an exchange.
The old c++ API did not have that same functionality built in to it, so the application developer needed to go through the steps manually as in the pub-sub example. In the pub-sub example you can start multiple lilsteners and then when you publish messages, each listener will receive every published message it is interested in. This is the same pattern of message flow as generally implied by a JMS Topic, and the brokers view is the same in each case.
--------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:[email protected]
