qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eugene <eugen.ra...@gmail.com>
Subject x-bindings misunderstanding
Date Fri, 23 Nov 2012 13:38:58 GMT
Hello,

I am trying to use the x-bindings property and I just can't. :(
Here is my case scenario:

Here is the producer:

String ALTERNATE_EXCHANGE = "amq.topic";
String producerQueue  ="producerQ; {create:always,
node:{x-declare:{auto-delete:true, exclusive:true, alternate-exchange:
'"+ALTERNATE_EXCHANGE+"'}}}"; // +
Session session = createSession();
MessageProducer producer =
session.createProducer(session.createQueue(requestsQueue));
TextMessage message      = session.createTextMessage("Some Payload");
producerDirect.send(message);
Thread.sleep(10 * 1000);

So, while this is running (Thread.sleep), I stop it. What this means is that
the message that is in the producerQ will get orphaned and because of the
alternate-exchange presence will get routed to the amq.topic exchange. This
is pretty clear to me.

Now the second part, before starting the code above, I start this one:

Session session = createSession();
Queue receiverQ  = session.createQueue("receiverQ; {create: receiver,
node:{x-bindings:[{exchange:'amq.topic', key:'producerQ',
queue:'receiverQ'}]}} ");		
MessageConsumer consumer = session.createConsumer(receiverQ);
consumer.setMessageListener(new TestListener());
while(true){}


private static final class TestListener implements MessageListener {
		@Override
		public void onMessage(Message message) {
			System.out.println("================ received");
			try {
				AMQDestination destination =
(AMQDestination)message.getJMSDestination();
				System.out.println("============= " + destination.getRoutingKey());
			} catch (JMSException e) {
				e.printStackTrace();
			}
		}
	}

Now I assume that because of the x-bindings declaration, the messages that
end in the amq.topic exchange and have the routing key set to : "producerQ"
will end in my receiverQ that I have a listener on.

But (otherwise I would not write this), no message gets into my listener.

I think that there is something wrong with the declaration of x-bindings,
but I am not sure.


Thank You,
Eugene.

 




--
View this message in context: http://apache-qpid-developers.2158895.n2.nabble.com/x-bindings-misunderstanding-tp7583454.html
Sent from the Apache Qpid developers mailing list archive at Nabble.com.

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


Mime
View raw message