[rabbitmq-discuss] How do I delete a persistent message after successul consuming

anate ambatinr at hotmail.com
Tue Apr 1 20:51:11 BST 2014


I have a durable and persistent message and trying to consume it and insert
into the database. If everything goes well(no exception) then I would like
to delete a message from queue. I don't see any examples online using C#.
Could you please let me know?

         try{
            using (IConnection connection =
connectionFactory.CreateConnection())
            {
                using (var channel = connection.CreateModel())
                {
                   channel.QueueDeclare("hello-world-queue", false, true,
false, null);

                    var consumer = new QueueingBasicConsumer(channel);
                    channel.BasicConsume("hello-world-queue", true,
consumer);

                    while (true)
                    {
                        var ea =
(BasicDeliverEventArgs)consumer.Queue.Dequeue();
                        //Insert data into database 
                        // delete message from queue
                    }
                }
              }
             }
             catch(ex as Exception)
             {
                      // show error message
             }





--
View this message in context: http://rabbitmq.1065348.n5.nabble.com/How-do-I-delete-a-persistent-message-after-successul-consuming-tp34473.html
Sent from the RabbitMQ mailing list archive at Nabble.com.


More information about the rabbitmq-discuss mailing list