There is a processing of messages from the queue according to this scheme:
q_connection = pika.BlockingConnection( pika.ConnectionParameters( host='127.0.0.1', virtual_host='/', credentials=pika.PlainCredentials( username='user', password='password' ) ) ) channel = q_connection.channel() channel.queue_declare( queue='processing', passive=False, durable=True, exclusive=False, auto_delete=False ) channel.exchange_declare(exchange='router', type='direct', passive=False, durable=True, auto_delete=False) channel.queue_bind('processing', 'router') def callback(ch, method, properties, body): # действия над полученными сообщениями ... ch.basic_ack(delivery_tag=method.delivery_tag) # а вот тут периодически вылетает ошибка channel.basic_consume( callback, queue='processing' ) channel.start_consuming() Occasionally an error occurs: The AMQP connection was closed: () when calling the basic_ack в callback method basic_ack в callback .
I assume that actions on messages take a long time to lose the connection.
How can I increase the time-out time, or how to make a reconnect in case of an exception?