[rabbitmq-discuss] Using pika - PRECONDITION_FAILED - unknown delivery tag 1

Marek Majkowski majek04 at gmail.com
Mon Mar 5 17:30:30 GMT 2012


On Mon, Mar 5, 2012 at 17:25, Ezequiel Golub <ezequiel.golub at gmail.com> wrote:
> Hey guys, i was wondering if any of you could lend me a hand with
> getting my rabbitmq project off the ground.
>
> I need to have multiple queues, with strong but not absolute
> guarantees that message will be delivered only once and redelivered if
> not ack is sent.
> I took the code examples in
> http://www.rabbitmq.com/tutorials/tutorial-two-python.html and
> modified just a little, and i'm getting the following failure after a
> number of messages are received (emphasis added):

> ---- test_consumer.py ----
> import pika, time
>
>
> def consume(ch, method, properties, body):
>    print " [x] Received %r" % (body,)
>    print "Sleeping for 5 seconds"
>    time.sleep(5)
>    print "Sending delivery tag = %s " % method.delivery_tag
>    ch.basic_ack(delivery_tag = method.delivery_tag)

Here you send an ack.

> def main():
>    connection =
> pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))
>    channel = connection.channel()
>    channel.exchange_declare(exchange="main", type="direct",
> durable=True,auto_delete=False,)
>    print "suscribing"
>    channel.basic_qos(prefetch_count=0)
>    channel.basic_consume(consume,
>                      queue='queue_2012030505',
>                      no_ack=True,

no_ack = True means that you don't want to send acks.

That's one possibility of your problem.

Cheers,
  Marek


More information about the rabbitmq-discuss mailing list