[rabbitmq-discuss] Dead letter message don't show up

Tim Watson tim at rabbitmq.com
Fri Nov 15 09:21:25 GMT 2013


On 15 Nov 2013, at 02:15, Huang Tonglang wrote:
> I declare the dead letter in producer side as following:
> channel.exchangeDeclare("dead-exchange", "direct");


>             Map<String, Object> args = new HashMap<String, Object>();
>             args.put("x-dead-letter-exchange", "dead-exchange1");
>             args.put("x-dead-letter-routing-key", "dead-exchange-routing-key");

That's pointing to 'dead-exchange1' instead of 'dead-exchange' - did you mean to do that?

>             channel.queueDeclare(“myqueue”, false, false, false, args);
>             channel.queueDeclare("dead-exchange-routing-key", false, false, false, null);
>             String message = "Hello World!”;
>             channel.basicPublish("",“myqueue”, MessageProperties.PERSISTENT_TEXT_PLAIN, message.getBytes());

You probably also want to bind the 'dead-exchange-routing-key' to 'dead-exchange' as well. With a direct exchange, messages go to the queues whose `binding key' exactly matches the routing key of the message. Only the default exchange (called "") will "magically" route messages whose routing key matches a queue's name.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20131115/4ac1d6c6/attachment.htm>

More information about the rabbitmq-discuss mailing list