How to set message expiration (TTL) in Celery?

You can publish messages to the RabbitMQ queue with an expiration TTL: such messages expire after the TTL expires and (if the dead letter queue is configured) are deleted in the dead letter queue.

But is it possible to specify such a TTL message using Celery?

Please note that I am not looking for a way to indicate the expiration of the task, but rather the expiration of the message. I want my messages to spend (custom) the amount of time in the queue before finally catching the @ dead-letter queue.

TIA.

+6
source share
1 answer

You can use Celery soft_time_limit or hard_time_limit when defining or calling a celery task. For more information, please contact

0
source

Source: https://habr.com/ru/post/1207106/


All Articles