[rabbitmq-discuss] consuming a message from exchange does not seem to work on java client (3.2.0 as well as 3.1.5)

Murugesan Guruswamy murugesan at elementum.com
Mon Nov 4 06:22:42 GMT 2013


Hi,

I am trying to experiment exchanges and publishing it to an exchange using 
following code:

Connection conn = factory.newConnection(addr);

Channel channel = conn.createChannel();

channel.exchangeDeclare(exchangeName, topicName, true); // durable. topic 
is "direct" and "topic" and have tried both

                channel.basicPublish(exchangeName, routingKey, null, 
msg.getBytes());


consumer code: (Tried both Queueing Consumer and my own Consumer imll).

Channel channel = conn.createChannel(); 

channel.exchangeDeclare(exchangeName, topicName, true);

channel.queueDeclare(queueName, true, false, false, null);

channel.queueBind(queueName, exchangeName, routingKey);

QueueingConsumer qCon = new QueueingConsumer(channel);

 channel.basicConsume(queueName, false, qCon);

while (true) {

Delivery delivery = qCon.nextDelivery();

System.out.println("[x] " + new String(delivery.getBody()) + " " + 
delivery.getEnvelope().getRoutingKey());

 qCon.getChannel().basicAck(delivery.getEnvelope().getDeliveryTag(), false);

}

Routing key : "test.abc", queueName : Notification, exchangeName : 
localExchange.

Is there any rabbitmq-server configurations to do?

Please help here.

Thanks,
Murugesan




-- 
 

Legal Disclaimer: The information contained in this message may be 
privileged and confidential. It is intended to be read only by the 
individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice 
that any distribution of this message, in any form, is strictly prohibited. 
If you have received this message in error, please immediately notify the 
sender and delete or destroy any copy of this message 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20131103/10f8cbff/attachment.htm>


More information about the rabbitmq-discuss mailing list