Hi Jeremy,

the Qpid brokers are based on the model of AMQP 0-9/0-10 where there are
two entity types, "Queues" and "Exchanges" - there is no concrete concept
of a "topic" within the broker model.  A message is sent to an Exchange
which routes the incoming message to queues based on the type of the
exchange, the metadata associated with the message and how queues are
"bound" to the exchange.  Consumers of messages must always consume their
messages from a queue (they cannot consume directly from an exchange.  Your
config xml is creating an exchange.

To get "topic" like behaviour (where many consumers all receive the same
stream of messages) the broker needs to set up a queue for each consumer
and bind this queue to the exchange which is acting as the incoming
address.

One way of getting topic like behaviour is to say that for each topic one
creates an exchange in the broker (such as the exchange you create).  And
for each consumer on the topic we create a private temporary queue (which
auto deletes as soon as the consumer is closed).  This is what the JMS
client does when you create a consumer on a (JMS) Topic.  For the name of
the temporary queue it uses the topic name followed by a random string to
ensure uniqueness amongst all subscriptions.  These temporary queues which
you see through JMX are simply a manifestation of this implementation
strategy (though I would have expected them only to be created when
creating a receiver through the code - there is no real need to create them
for a Sender).

(As an aside the exchange type "topic" is somewhat of a misnomer, one could
also use a direct, fanout or headers exchange to provide such topic like
behaviour).

If you test the behaviour you get when creating multiple receivers and a
single sender for your "topic" you should see that you get the expected
semantics (the message is delivered to all receivers).

Hope this helps,
Rob

On 28 May 2013 18:56, Jeremy Wagner <[email protected]> wrote:

> Hello,
>
> When I set up a sender and receiver to a topic using Qpid 0.18, I noticed
> that the topic appears under Queues instead of Topics when viewed through
> the JMX console, even though I already have the topic defined in the XML
> configuration file. It also appears to have a randomized string of
> hexadecimals appended to the topic name under Queues.
>
> For example, I have the topic, "test.topic", defined in the XML
> configuration file as follows:
>
> ...
> <exchanges>
> <exchange>
> <type>topic</type>
> <name>test.topic</name>
> </exchange>
> <exchanges>
> ...
>
> When I bring up the JMX console, everything looks fine as the test.topic
> appears under Topics. However, when I set up a receiver or a sender to that
> topic as follows (ignoring error cases):
>
> Connection connection("localhost", "<connection options goes here...>");
> connection.open();
> Session session = connection.createSession();
> Sender sender = session.createSender("test.topic"); // this appears to
> create "test.topic_randomized_string_of_hexadecimals)" under Queues
> Receiver receiver = session.createReceiver("test.topic"); // same as above
>
> Since it created a "topic" under "Queues", I tried the following code to
> set the address' type as "topic" as follows:
>
> Connection connection("localhost", "<connection options goes here...>");
> connection.open();
> Session session = connection.createSession();
> Address address("test.topic");
> address.setType("topic");
> Sender sender = session.createSender(address); // it still connects to
> "test.topic_randomized_string_of_hexadecimals" under Queues
> Receiver receiver = session.createReceiver(address); // same as above
>
> So I'm not sure why I'm unable to connect to the defined "test.topic" as
> stated in the XML configuration file. Any advice would be appreciated.
> Thank you.
>
> Regards,
> Jeremy

Reply via email to