This document is for Kombu's development version, which can be significantly different from previous releases. Get the stable docs here: 5.3.
Native Delayed Delivery - native_delayed_delivery¶
Added in version 5.5.
Native Delayed Delivery API.
Only relevant for RabbitMQ.
- kombu.transport.native_delayed_delivery.bind_queue_to_native_delayed_delivery_exchange(connection: Connection, queue: Queue, prefix: str | None = None) None[source]¶
Bind a queue to the native delayed delivery exchange.
When a message arrives at the delivery exchange, it must be forwarded to the original exchange and queue. To accomplish this, the function retrieves the exchange or binding objects associated with the queue and binds them to the delivery exchange.
- Parameters:
connection (Connection) – The connection object used to create and manage the channel.
queue (Queue) – The queue to be bound to the native delayed delivery exchange.
prefix (str | None) – Optional prefix for delayed delivery exchange and queue names;
Noneor""means no prefix is applied.
Warning:¶
If a direct exchange is detected, a warning will be logged because native delayed delivery does not support direct exchanges.
- kombu.transport.native_delayed_delivery.calculate_routing_key(countdown: int, routing_key: str) str[source]¶
Calculate the routing key for publishing a delayed message based on the countdown.
- kombu.transport.native_delayed_delivery.declare_native_delayed_delivery_exchanges_and_queues(connection: Connection, queue_type: str, prefix: str | None = None) None[source]¶
Declare all native delayed delivery exchanges and queues.
The generated delayed exchange/queue names use
prefixwhen it is a non-empty string. In that case, level names are created as"{prefix}_celery_delayed_{level}"and the delivery exchange is named"{prefix}_celery_delayed_delivery". IfprefixisNoneor an empty string, no prefix is applied and the default names"celery_delayed_{level}"and"celery_delayed_delivery"are used.