qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gordon Sim <g...@redhat.com>
Subject Re: Uncanny differences
Date Fri, 13 Jan 2012 12:24:05 GMT
On 01/13/2012 05:19 AM, Kalle wrote:
> Hi,
> Java client, cpp broker.
> When I do (a bit of a pseudocode here, I'll post with actual examples if necessary)
> Topic t = session.createtopic("yyy");
> MessagePublisher p = session.createPublisher(t);
> MessageSubscriber s = session.createSubscriber(t);
> things work. But when I do:
> Topic t = session.createtopic("xxx/yyy");
> MessagePublisher p = session.createPublisher(t);
> MessageSubscriber s = session.createSubscriber(t);
> they don't. What I see is that when I define my topic with a /, in order to use my own
exchange, not all consumers get my messages. Messages seem to go to just one consumer (which
ever got the message first). This would mean that they are in fact listening in a totally
different pattern, than in the first case (topic with default exchange).
> Why does it work like this? Is this a bug, or a feature I've yet to learn to like? :)

Here is what I think is happening, perhaps someone more familiar with 
the evolution of code in question can confirm or refute this and provide 
some context...

If you don't have a '/' (or a ';') in the string passed to the 
createTopic() method, the string is used as the routing key and 
amq.topic is used as the exchange. (That was a surprise to me).

If you do have one of those characters, the string is interpreted as an 
address (or a binding 'URL', based on settings).

My guess is that the address xxx/yyy is resolving to a queue named xxx, 
and that is causing the distribution pattern you are seeing (competing 
consumers where the first consumers prefetch means it gets the bulk of 
the messages sent). Is there a queue named xxx on your broker?

If that is what is happening, you could try 'xxx/yyy; 
{node:{type:topic}}' which explicitly states the node should be a topic.

As to whether it is a bug, it is certainly confusing behaviour. You 
could reasonably assume that the destination returned from createTopic() 
is always a topic(!). We certainly need the behaviour to be clearly 
explained somewhere.

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

View raw message