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

Alvaro Videla videlalvaro at gmail.com
Mon Nov 4 16:13:29 GMT 2013


Is the routing key used when publishing the same as the binding key?


On Mon, Nov 4, 2013 at 7:22 AM, Murugesan Guruswamy <murugesan at elementum.com
> wrote:

> 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
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20131104/45cbfc57/attachment.htm>


More information about the rabbitmq-discuss mailing list