Error “unknown delivery tag” occurs when i try ack messages to RabbitMQ using pika (python)

前端 未结 7 1033
别跟我提以往
别跟我提以往 2021-02-07 00:57

I want process messages in few threads but i\'m getting error during execute this code:

from __future__ import with_statement
import pika
import sys
from pika.ad         


        
7条回答
  •  隐瞒了意图╮
    2021-02-07 01:03

    After seeing RabbitMQ - upgraded to a new version and got a lot of "PRECONDITION_FAILED unknown delivery tag 1"

    I changed my basic-consume to look like this:

        consumer_tag = channel.basic_consume(
            message_delivery_event,
            no_ack=True,
            queue=queue,
        )
    

    This had the effect of causing the described error on initial (not redelivered) acknowledgements when the message's delivery tag was specified. The delivery was extracted from the message delivery's method structure.

    Using

        channel.basic_ack(delivery_tag=0)
    

    suppresses the error in this case, too

    Looking at http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2011-July/013664.html makes it seem as though it may be an issue in RabbitMQ.

提交回复
热议问题