[rabbitmq-discuss] How to setup dead-letter queue in C# ?

Johan Klijn johanklijn_nl at hotmail.com
Tue Dec 11 12:10:26 GMT 2012

I am using RabbitMQ v2.8.1.

your sample is working, and I managed to declare the exchange also, using
the code below. When I specify the exchange type of Direct for the
dead-letter-exchange it is not working. That's probably the reason why it
was not working for me.

            ConnectionFactory cf = new ConnectionFactory();
            cf.HostName = "";
            using (IConnection conn = cf.CreateConnection())
                using (IModel ch = conn.CreateModel())

                    ch.QueueDeclare("DeadLetterQueue2", true, false, false,
"DeadLetterQueue2Exchange", "");
                    Hashtable arguments = new Hashtable() 
                     {"x-dead-letter-exchange", "DeadLetterQueue2Exchange"} 
                    ch.QueueDeclare("MessageQueue2", true, false, false,
                    ch.BasicPublish("", "MessageQueue2", null, new byte[0]);
                    BasicGetResult result = ch.BasicGet("MessageQueue2",
                    ch.BasicNack(result.DeliveryTag, false, false);

View this message in context: http://rabbitmq.1065348.n5.nabble.com/How-to-setup-dead-letter-queue-in-C-tp23913p23977.html
Sent from the RabbitMQ mailing list archive at Nabble.com.

More information about the rabbitmq-discuss mailing list