Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Mar 9, 2024
Merged

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

merged 1 commit into from
Mar 9, 2024

Conversation

jcosmao
Copy link
Contributor

@jcosmao jcosmao commented Mar 1, 2024

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.

Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add some tests to verify this?

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.

(cherry picked from commit e1fa168)
Signed-off-by: julien.cosmao <[email protected]>
@Nusnus Nusnus merged commit bda9a2f into celery:main Mar 9, 2024
16 checks passed
@jcosmao jcosmao deleted the dev/julien.cosmao/cancel_callback branch March 9, 2024 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants