I cannot seem to get the code running - I've been using Pika and keen to try out this thread safe and possibly neater version.
import rabbitpy
with rabbitpy.Connection('amqp://guest:guest@localhost:5672/%2f') as conn:
with conn.channel() as channel:
queue = rabbitpy.Queue(channel, 'example')
# Exit on CTRL-C
try:
# Consume the message
for message in queue:
message.pprint(True)
message.ack()
except KeyboardInterrupt:
print 'Exited consumer'
The error I get:
Traceback (most recent call last):
File "newshift.py", line 3, in <module>
with rabbitpy.Connection('amqp://guest:guest@localhost:5672/%2f') as conn:
AttributeError: 'module' object has no attribute 'Connection'
My systems settings are:
numpy==1.11.2
pamqp==1.6.1
pandas==0.19.0
pika==0.10.0
pkg-resources==0.0.0
python-dateutil==2.5.3
pytz==2016.7
rabbitpy==1.0.0
six==1.10.0
SQLAlchemy==1.1.3
dir(rabbitpy)
['__builtins__', '__doc__', '__file__', '__name__', '__package__']
Somehow the classes are not seen when loading in the module
Original issue was caused by .pyc files hanging around, but new error message is:
Traceback (most recent call last):
File "newshift.py", line 15, in <module>
print 'Exited consumer'
File "/home/brett/code/SimpleConsumers/local/lib/python2.7/site-packages/rabbitpy/connection.py", line 149, in __exit__
raise exc_val
rabbitpy.exceptions.AMQPNotFound: <pamqp.specification.Channel.Close object at 0x7f39a91da7d0>