Hi,
I have a callback function which process a long message. It takes around 40 to 50 seconds to process the message.
And then i have the following code in the callback function,
if ch.is_open:
print "channel is open: ", ch.is_open
print "Method delivery tag: ", method.delivery_tag
else:
print "Channel is closed"
ch.basic_ack(delivery_tag = method.delivery_tag)
The above code always prints "Connection is open ... ". There are more than 1000 messages in the queue. Need to process all the messages. And it is failing with the following error:
File "receive_vb.py", line 200, in <module>
channel.start_consuming()
File "/usr/lib/python2.7/site-packages/pika/adapters/blocking_connection.py", line 1822, in start_consuming
self.connection.process_data_events(time_limit=None)
File "/usr/lib/python2.7/site-packages/pika/adapters/blocking_connection.py", line 758, in process_data_events
self._dispatch_channel_events()
File "/usr/lib/python2.7/site-packages/pika/adapters/blocking_connection.py", line 521, in _dispatch_channel_events
impl_channel._get_cookie()._dispatch_events()
File "/usr/lib/python2.7/site-packages/pika/adapters/blocking_connection.py", line 1445, in _dispatch_events
evt.body)
File "receive_vb.py", line 180, in callback
ch.basic_ack(delivery_tag = method.delivery_tag)
File "/usr/lib/python2.7/site-packages/pika/adapters/blocking_connection.py", line 2031, in basic_ack
self._flush_output()
File "/usr/lib/python2.7/site-packages/pika/adapters/blocking_connection.py", line 1292, in _flush_output
*waiters)
File "/usr/lib/python2.7/site-packages/pika/adapters/blocking_connection.py", line 477, in _flush_output
result.reason_text)
pika.exceptions.ConnectionClosed: (-1, "error(104, 'Connection reset by peer')")
If I run without basic_ack, I get the connection reset by peer for some messages randomly (sometime for the second message, sometime 88th message, sometime, 61st message etc. But when i run with basic_ack, fails in first message itself. I tried setting heartbeat_interval parameter to zero and and also to 150, the result is same still. What am I missing here. Can someone help me with this issue? Thanks in Advance.
Regards,
Manoj G