[rabbitmq-discuss] question : How to not delete message from queue

bino oetomo bino at indoakses-online.com
Wed May 16 08:18:04 BST 2012


Dear All ..

I try to run 
https://github.com/rabbitmq/rabbitmq-tutorials/blob/master/python/worker.py
It work fine.

But I really need to be able to not delete message from queue, in case 
there is exception.

 From the original callback part :

-----Start----
def callback(ch, method, properties, body):
     print " [x] Received %r" % (body,)
     time.sleep( body.count('.') )
     print " [x] Done"
     ch.basic_ack(delivery_tag = method.delivery_tag)
-----Stop----

My question is how to do something like :
-----Start----
def callback(ch, method, properties, body):
     print " [x] Received %r" % (body,)
     time.sleep( body.count('.') )
     isSuceed = True
     try :
         print " [x] Done"
     except :
         isSucceed = False
     if isSucceed :
         ch.basic_ack(delivery_tag = method.delivery_tag)
     else :
         #Here is my question :
         #How to keep (not deleting) the message in Queue ?
-----Stop----

Kindly please give me your enlightment.

Sincerely
-bino-



More information about the rabbitmq-discuss mailing list