You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Jeremy Wagner <co...@yahoo.com> on 2013/05/28 18:56:17 UTC

When setting senders/receivers to a topic, it creates a topic with randomized string of hexadecimals under Queues?

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

Re: When setting senders/receivers to a topic, it creates a topic with randomized string of hexadecimals under Queues?

Posted by Rob Godfrey <ro...@gmail.com>.
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 <co...@yahoo.com> 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

Re: When setting senders/receivers to a topic, it creates a topic with randomized string of hexadecimals under Queues?

Posted by Gordon Sim <gs...@redhat.com>.
On 05/28/2013 05:56 PM, Jeremy Wagner 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.

A topic is emulated by the receivers creating and binding a subscription 
queue to the specified exchange. Messages published to that exchange 
will then be routed to any queue whose binding matches.

The queues you are seeing are subscription queues, bound to the 
test.topic exchange. They are given unique names by adding a UUID to the 
exchange name.

Does that make sense? I assume your senders and receivers were all able 
to communicate?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org