builtins.TypeError: basic_consume() got an unexpected keyword argument 'no_ack'

created at 03-31-2022 views: 5

problem

In the past few days, the rabbitmq consumer mode has been unable to be turned on, and the following error has occurred:

builtins.TypeError: basic_consume() got an unexpected keyword argument 'no_ack'

This sentence means: The call to the method basic_consume() has an unexpected keyword no_ack That is, the keyword no_ack in this method, right? So I invoked the prompt parameter of basic_consume in pycharm, as shown below:

parameter of basic_consume in pycharm

The no_ack keyword is correct, I re-entered it, uploaded it to the server and still got the same error.

So I searched and went to the rabbitmq official website to see the latest documentation. There is no problem. Next, I found the official pika documentation that caught my attention.

I compared my pikia version to 1.1.0, and then I found the problem, and sure enough, the keywords changed.

solution

basic_consume(queue, auto_ack=False, exclusive=False, consumer_tag=None, arguments=None)

Change it to auto_ack.

Please log in to leave a comment.