ask/kombu — Issue #97: Kombu 2.0.0 / Pylibrabbitmq 0.5.0 Traceback
Author: kwloafman
Created: 2012-01-28 22:27:57+00:00
State: open

I just upgraded from Kombu 1.1.5 and Pylibrabbitmq 0.4.0 to the latest and greatest. I'm now getting the following traceback:

Traceback (most recent call last):
File "/opt/mmi/src/mindtracker/base/mq/helper.py", line 102, in fetch
message = self.consumer.fetch()
File "/usr/local/lib/python2.6/dist-packages/kombu/compat.py", line 143, in fetch
message = self.queues[0].get(no_ack)
File "/usr/local/lib/python2.6/dist-packages/kombu/entity.py", line 440, in get
message = self.channel.basic_get(queue=self.name, no_ack=no_ack)
File "/usr/local/lib/python2.6/dist-packages/pylibrabbitmq-0.5.0-py2.6-linux-x86_64.egg/pylibrabbitmq/__init__.py", line 59, in basic_get
frame = self.connection._basic_get(queue, no_ack, self.channel_id)
TypeError: an integer is required

Here is the code I'm using to set up the consumer:

```python
self.conn = BrokerConnection(
hostname = self.hostname,
port = self.port,
userid = self.userid,
password = self.password,
transport = 'librabbitmq'
)
self.consumer = kombu.compat.Consumer(
connection = self.conn,
exchange = self.exchange_name,
queue = self.queue_name,
exchange_type = "fanout",
auto_delete = not self.permanent,
)
self.consumer.qos(prefetch_count = self.prefetch)
```

and here's the code used to fetch the data:

```python
for nt in range(MAX_TRIES):
try:
message = self.consumer.fetch()
break
except Exception as e:
time.sleep(nt + 1)
self.consumer.revive(self.conn.channel())
else:
logger.warning("Fetch failed %d times: %s" % (MAX_TRIES, str(e)))
return None
```

We don't need callbacks or anything fancy, just basic get/put. Please let me know if there's anything more you need.

...Thanks,
...Ken