'pika: TypeError: queue_declare() got an unexpected keyword argument 'callback'
According to the doc, a callback argument should be supported. Also according to the source code.
I am doing
def declare_ok(method: pika.frame.Method):
while True: # TODO busy waiting until a better way is found
try:
print(f"Attempting to bind {queue_name}")
channel.queue_bind(queue=queue_name, exchange=queue_params.exchange,
routing_key=queue_params.routing_key)
print(f"Successful bind to {queue_name}")
break
except pika.exceptions.ChannelClosedByBroker as ex:
time.sleep(0.1)
except pika.exceptions.ChannelWrongStateError as ex:
time.sleep(0.1)
channel.queue_declare(queue_name, callback=declare_ok)
and getting
TypeError: queue_declare() got an unexpected keyword argument 'callback'
What's the correct way to pass a callback?
Solution 1:[1]
Pika has extensive example code you can use:
https://github.com/pika/pika/blob/master/examples/asynchronous_consumer_example.py#L198-L208
I suspect this is your message on the mailing list, please follow up there:
https://groups.google.com/g/pika-python/c/rcOeU8NW9JM
NOTE: the RabbitMQ team monitors the rabbitmq-users mailing list and only sometimes answers questions on StackOverflow.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Luke Bakken |
