I try to constantly listen to the queue, but after about a minute (if my queue is empty), I disconnected from this error:
DEBUG:pika.adapters.blocking_connection:Outbound buffer size: 0 DEBUG:pika.adapters.blocking_connection:Outbound buffer size: 0 ERROR:pika.adapters.base_connection:Read empty data, calling disconnect DEBUG:pika.adapters.blocking_connection:Handling disconnect INFO:pika.adapters.blocking_connection:on_connection_closed: None, True WARNING:pika.adapters.blocking_connection:Received Channel.Close, closing: None DEBUG:pika.callback:Clearing out '1' from the stack Traceback (most recent call last): File "controller.py", line 59, in <module> c.run() File "controller.py", line 55, in run self.listen_queue() # Blocking function File "controller.py", line 25, in listen_queue self.channel.start_consuming() # Start consuming File "/usr/local/lib/python2.7/dist-packages/pika/adapters/blocking_connection.py", line 814, in start_consuming self.connection.process_data_events() File "/usr/local/lib/python2.7/dist-packages/pika/adapters/blocking_connection.py", line 168, in process_data_events if self._handle_read(): File "/usr/local/lib/python2.7/dist-packages/pika/adapters/blocking_connection.py", line 272, in _handle_read super(BlockingConnection, self)._handle_read() File "/usr/local/lib/python2.7/dist-packages/pika/adapters/base_connection.py", line 315, in _handle_read return self._handle_disconnect() File "/usr/local/lib/python2.7/dist-packages/pika/adapters/blocking_connection.py", line 263, in _handle_disconnect self._on_connection_closed(None, True) File "/usr/local/lib/python2.7/dist-packages/pika/adapters/blocking_connection.py", line 321, in _on_connection_closed self._channels[channel]._on_close(method_frame) File "/usr/local/lib/python2.7/dist-packages/pika/adapters/blocking_connection.py", line 914, in _on_close raise exceptions.ChannelClosed(0, 'Not specified') pika.exceptions.ChannelClosed: (0, 'Not specified')
And this is my code:
class RabbitConnector(): def __init__(self): self._connect() def _connect(self): logger.info('Trying to connect to RabbitMQ') while True: try: conn_broker = pika.BlockingConnection( pika.ConnectionParameters( host=conf.rabbit_server, port=conf.rabbit_port, virtual_host=conf.rabbit_vhost, ssl=conf.rabbit_ssl,
source share