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

前端 未结 7 1050
别跟我提以往
别跟我提以往 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:06

    The problem probably is that you're setting no_ack=True like this:

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

    And then acknowledging the messages:

    channel.basic_ack(delivery_tag=args.delivery_tag)
    

    You have to chose if you want to acknowledge or not and set the correct consume parameter.

提交回复
热议问题