1

Is it possible to use Dead Letter Exchanges to handle both retrying a task and archiving tasks that failed more than retry_max number of times?

Most articles I've read set it up so that when a task fails, it is nacked so the task is sent to a retry-queue via a DLX. retry-queue has a TTL and is configured to send the dead message back to worker-queue.

What I would like to do is to send the message to a different queue, e.g.: dead-queue, when the maximum number of retries fails for manual intervention later. Is this possible using nack?

The diagram in the second answer here suggests that I can somehow nack the message when the max retries is exceeded and send it to a "Fail Exchange" but I'm not sure how I can nack the message and have it delivered to a different exchange.

  • There is no way to automatically do this, so you need to handle it in your code, preferably using the x-death header. – Martin Wickman Oct 08 '19 at 06:54
  • What I asked wasn't possible. I've decided to continue using `nack` to have RabbitMQ send the task from `worker-queue` to the `retry-queue` and when `retry_max` is exceeded, I use `ack` to remove the message from `worker-queue` and explicitly code the consumer to handle sending the old task as a new task to `dead-queue`. Not ideal because the consumer/worker can fail between the `ack` and sending the task as a new job to `dead-queue` but compromises must be made. – trivial_tasks Oct 09 '19 at 04:26

0 Answers0