On 11/21/2012 11:29 AM, eugene wrote:
Darn this is still not working for me.

Here is the consumer flow:

AMQTopic topic = (AMQTopic)session.createTopic("amq.topic/TEST_QUEUE");
MessageConsumer consumer = session.createConsumer(topic);
consumer.setMessageListener(new MyMessageListener());
                                
//Should be a flag here, but ignore for now
while(true){}

Did you call Connection.start() for the listeners connection? Without that, messages won't actually get pulled in. (From the log it looks like the flow of messages is not fully enabled).

And here is the producer flow:

Queue testQueue = session.createQueue("TEST_QUEUE; {create:always,
node:{x-declare:{auto-delete:true, exclusive:true, alternate-exchange:
'"+ALTERNATE_EXCHANGE+"'}}}");
MessageProducer producer = session.createProducer(testQueue);
TextMessage message      = session.createTextMessage("Some value");
producer.send(message);

Does the producer program exit after this line? (Just checking that the session actually gets terminated).

Now this should definitely work. The message has the routing key set to
'TEST_QUEUE', and the Topic has the same binding-key. Nevertheless I do not
see any message in the Listener.

As above, this could be a failure to start the listeners connection.

If not, using qpid-stat, can you verify the TEST_QUEUE is gone? What stats are reported for amq.topic and the subscription queue bound to that?

I've sent the logs.

A couple of things also.

Seems like creating a queue and a Topic with the same name is going to be a
'must' for this, because
     sending a message with qpid.subject will not override the routing-key,
isn't it?

If you send a message to the queue then the routing key under 0-10 has to be the queue name and the library ensures that it is. This means that if such a message is then routed to an alternate exchange which is of type 'topic' or 'direct', then any subscriber to that alternate-exchange will have to specify the queue name(s) of interest.

I mean if I want to have this functionality in place, the receiving topic
(because the message will get it's routing-key with the same name as the
sending queue), must have the same binding as the routing key.
The way this is achieved is to set the topic name to the binding key.

You would set the 'subject' part of the address to be the original queue name. (The 'name' part of the address would be the name of the alternate-exchange itself). E.g. my-alternate-exchange/my-queue

Or is there a way to set the binding key of the topic through some x-declare
setting? For example, exclusive:true, bindingkey='...'.

You can further play with the bindings using the x-bindings of the link. I'm not sure if you need that though. Can you perhaps describe the sort of pattern of flow you would ideally have in place?


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to