Skip to content

Add native delayed delivery queues prefix conf - #10316

Open
mina58 wants to merge 5 commits into
celery:mainfrom
mina58:delayed-delivery-queue-prefix
Open

mina58 wants to merge 5 commits into
celery:mainfrom
mina58:delayed-delivery-queue-prefix

Conversation

@mina58

@mina58 mina58 commented May 16, 2026

Copy link
Copy Markdown
Contributor

Description

Adds a new broker_native_delayed_delivery_queue_prefix configuration option that allows namespacing the native delayed delivery exchange and queue names. This is useful when multiple Celery applications share the same RabbitMQ broker and need their delayed delivery infrastructure isolated to avoid collisions.

When set, the delayed delivery exchange becomes {prefix}_celery_delayed_delivery and each of the 28 level queues becomes {prefix}_celery_delayed_{level}. When unset (the default), behavior is unchanged.

Fixes #10310 (follow-up to #10269).

Changes

  • celery/app/defaults.py — new broker_native_delayed_delivery_queue_prefix setting (defaults to None for backward compatibility).
  • celery/worker/consumer/delayed_delivery.py — reads the new setting and forwards it to both kombu setup functions.
  • docs/userguide/configuration.rst — new setting documented with versionadded:: 5.7 directive and entry in the settings table.
  • t/unit/worker/test_native_delayed_delivery.py — adds tests verifying the prefix is forwarded to both kombu functions (and that None is forwarded when unset).

Backward compatibility

Fully backward compatible. The default value is None, which means kombu uses the original (unprefixed) names. Existing deployments require no changes.

@mina58
mina58 force-pushed the delayed-delivery-queue-prefix branch from e9d7c46 to 7bbc588 Compare May 16, 2026 18:40
@codecov

codecov Bot commented May 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.23%. Comparing base (17b895b) to head (92c5284).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10316   +/-   ##
=======================================
  Coverage   90.23%   90.23%           
=======================================
  Files         153      153           
  Lines       21071    21077    +6     
  Branches     2543     2545    +2     
=======================================
+ Hits        19013    19019    +6     
  Misses       1751     1751           
  Partials      307      307           
Flag Coverage Δ
unittests 90.21% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@auvipy auvipy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

please check the failing smoke tests

@mina58
mina58 force-pushed the delayed-delivery-queue-prefix branch from 0fe18d1 to 7bbc588 Compare May 17, 2026 11:37
@mina58

mina58 commented May 17, 2026

Copy link
Copy Markdown
Contributor Author

@auvipy the issue is that the smoke tests are using the release kombu version which doesn't support prefixes. do we wait until the next kombu release?

@mina58
mina58 requested a review from auvipy May 18, 2026 15:12
@auvipy

auvipy commented May 18, 2026

Copy link
Copy Markdown
Member

oh ok lets wait until kombu v5.7 alpha release.

@auvipy
auvipy requested a lite review from Copilot August 26, 2026 17:42
@auvipy auvipy added this to the 5.7.0 milestone Aug 26, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new configuration option to namespace RabbitMQ native delayed-delivery infrastructure so multiple Celery apps can share a broker without queue/exchange name collisions.

Changes:

  • Add broker_native_delayed_delivery_queue_prefix config (default None) for namespacing delayed-delivery exchange/queues.
  • Forward the configured prefix from the worker delayed-delivery bootstep into kombu’s native delayed-delivery setup/bind helpers.
  • Document the new option and add unit tests asserting the prefix forwarding behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
celery/app/defaults.py Adds the new broker namespace config option with default None.
celery/worker/consumer/delayed_delivery.py Reads the prefix from config and forwards it into kombu setup/bind calls.
docs/userguide/configuration.rst Documents the new setting and adds it to the env-var/settings mapping table.
t/unit/worker/test_native_delayed_delivery.py Updates mocks for new call signature and adds tests for prefix forwarding/defaulting.
Suppressed comments (1)

celery/worker/consumer/delayed_delivery.py:175

  • Same as above: an empty/whitespace prefix will currently be forwarded to bind_queue_to_native_delayed_delivery_exchange, producing awkward names. Normalizing to None keeps behavior aligned with the docs and avoids accidental "celery_delayed*" resources.
        queue_prefix = app.conf.broker_native_delayed_delivery_queue_prefix

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@auvipy auvipy modified the milestones: 5.7.0, 5.8.0 Aug 29, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add N_delayed_queue prefix configuration

3 participants