[rabbitmq-discuss] Help with "AttributeError: 'BlockingConnection' object has no attribute 'disconnect'"
Badjatya, Nikunj
Nikunj.Badjatya at emc.com
Tue Jan 21 19:21:08 GMT 2014
Hello All,
Need your help with the error I have been facing.
The channel creation (or the basic_publish operation) throws error as "AttributeError: 'BlockingConnection' object has no attribute 'disconnect'", when there is a time gap between connection establishment and channel creation (or basic_publish operation).
I am using Pika python amqp client and running rabbitmq-server ver 3.1.3-1 on SLES-11sp3.
Python 2.6.8 (unknown, May 29 2012, 22:30:44)
[GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pika
>>> VEXCHANGE = 'exchange.external'
>>> connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost',connection_attempts=3,retry_delay=5))
>>> vchannel = connection.channel();
>>> BODY = "blahblah"
>>> vchannel.basic_publish(exchange=VEXCHANGE,routing_key='#',body=str(BODY),properties=pika.BasicProperties(delivery_mode = 2,))
This message is getting published without any issues. However, if after sometime (say 5 minutes) I do basic_publish again, I get below error.
>>> vchannel.basic_publish(exchange=VEXCHANGE,routing_key='#',body=str(BODY),properties=pika.BasicProperties(delivery_mode = 2,))
No handlers could be found for logger "pika.adapters.base_connection"
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.6/site-packages/pika/adapters/blocking_connection.py", line 540, in basic_publish
(properties, body), False)
File "/usr/lib64/python2.6/site-packages/pika/adapters/blocking_connection.py", line 1121, in _send_method
self.connection.send_method(self.channel_number, method_frame, content)
File "/usr/lib64/python2.6/site-packages/pika/adapters/blocking_connection.py", line 249, in send_method
self._send_method(channel_number, method_frame, content)
File "/usr/lib64/python2.6/site-packages/pika/connection.py", line 1489, in _send_method
self._send_frame(frame.Method(channel_number, method_frame))
File "/usr/lib64/python2.6/site-packages/pika/adapters/blocking_connection.py", line 388, in _send_frame
super(BlockingConnection, self)._send_frame(frame_value)
File "/usr/lib64/python2.6/site-packages/pika/connection.py", line 1476, in _send_frame
self._flush_outbound()
File "/usr/lib64/python2.6/site-packages/pika/adapters/blocking_connection.py", line 348, in _flush_outbound
if self._handle_write():
File "/usr/lib64/python2.6/site-packages/pika/adapters/base_connection.py", line 338, in _handle_write
return self._handle_error(error)
File "/usr/lib64/python2.6/site-packages/pika/adapters/base_connection.py", line 282, in _handle_error
self._handle_disconnect()
File "/usr/lib64/python2.6/site-packages/pika/adapters/blocking_connection.py", line 318, in _handle_disconnect
self.disconnect()
AttributeError: 'BlockingConnection' object has no attribute 'disconnect'
>>>
At this time, I get the same error when I run
>>>vchannel = connection.channel()
The config file has the default heartbeat set to 30 seconds.
Any idea on what causing this error to come?
Thanks,
Nikunj
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140121/7dcfb64a/attachment.html>
More information about the rabbitmq-discuss
mailing list