celery / kombu

Messaging library for Python.
http://kombu.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
2.81k stars 920 forks source link

Expose cancel callback from py-amqp channel.basic_consume #1953

Closed jcosmao closed 3 months ago

jcosmao commented 4 months ago

When broker send Basic.cancel notification, py-amqp default behavior is to raise a ConsumerCancelled exception. It is then treated as an error even if connection and channel are still operationnal and connection is closed.

Basic.cancel may be sent by broker when a queue is deleted or when replicated queue leader change. py-amqp channel.basic_consume allow to define a callback function on this event. It may be useful to register this callback from kombu when consuming from a queue.