Comment
Author: Admin | 2025-04-28
I'm using pika python library to connect to rabbitmq-server on localhost.class BaseRabbitSender(MessageSender): __metaclass__ = ABCMeta def __init__(self, host): self.node = BaseMessagingNode(host) self.connection = pika.BlockingConnection(pika.ConnectionParameters( host=host)) self.channel = self.connection.channel() @abstractmethod def send_message(self, message): pass def close_connection(self): self.connection.close()class DirectRabbitSender(BaseRabbitSender): def __init__(self, host, queue_name): super(DirectRabbitSender, self).__init__(host) self.queue_name = queue_name self.channel.queue_declare(queue=queue_name, durable=True) def send_message(self, message): self.channel.basic_publish(exchange='', routing_key=self.queue_name, body=message, properties=pika.BasicProperties( delivery_mode=2, )) def close_connection(self): self.connection.close()For some reason after quite time (like couple of days) I'm getting error. File "build/bdist.linux-x86_64/egg/pika/adapters/blocking_connection.py", line 560, in basic_publish (properties, body), False) File "build/bdist.linux-x86_64/egg/pika/adapters/blocking_connection.py", line 1147, in _send_method self.connection.send_method(self.channel_number, method_frame, content) File "build/bdist.linux-x86_64/egg/pika/adapters/blocking_connection.py", line 267, in send_method self._send_method(channel_number, method_frame, content) File "build/bdist.linux-x86_64/egg/pika/connection.py", line 1504, in _send_method self._send_frame(frame.Header(channel_number, length, content[0])) File "build/bdist.linux-x86_64/egg/pika/adapters/blocking_connection.py", line 410, in _send_frame self.process_data_events() File "build/bdist.linux-x86_64/egg/pika/adapters/blocking_connection.py", line 236, in process_data_events raise exceptions.ConnectionClosed()ConnectionClosedRabbitmq server log=INFO REPORT==== 3-Mar-2014::15:11:03 ===accepting AMQP connection (127.0.0.1:41846 -> 127.0.0.1:5672)=ERROR REPORT==== 3-Mar-2014::15:38:12 ===closing AMQP connection (127.0.0.1:58580 -> 127.0.0.1:5672):{heartbeat_timeout,running}=WARNING REPORT==== 3-Mar-2014::16:11:04 ===closing AMQP connection (127.0.0.1:41846 -> 127.0.0.1:5672):connection_closed_abruptly=INFO REPORT==== 3-Mar-2014::16:11:05 ===accepting AMQP connection (127.0.0.1:37776 -> 127.0.0.1:5672)=ERROR REPORT==== 3-Mar-2014::17:41:05 ===closing AMQP connection (127.0.0.1:37776 -> 127.0.0.1:5672):{heartbeat_timeout,running}It's running on ubuntu 13.10. RabbitMQ 3.1.3I don't understand what happened. Can you explain?
Add Comment