From 0056c9d38a4f9e222e6dda8c46030c6dcfc47a3d Mon Sep 17 00:00:00 2001 From: Nathan Long Date: Thu, 24 Sep 2020 10:03:47 -0400 Subject: [PATCH] Clarify documentation for :on_success and :on_failure --- lib/broadway_rabbitmq/producer.ex | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/broadway_rabbitmq/producer.ex b/lib/broadway_rabbitmq/producer.ex index 755cb04..5ac4b80 100644 --- a/lib/broadway_rabbitmq/producer.ex +++ b/lib/broadway_rabbitmq/producer.ex @@ -177,16 +177,22 @@ defmodule BroadwayRabbitMQ.Producer do * `:ack` - acknowledge the message. RabbitMQ will mark the message as acked and will not redeliver it to any other consumer. - * `:reject` - rejects the message without requeuing (basically, discards the message). - RabbitMQ will not redeliver the message to any other consumer. + * `:reject` - rejects the message without requeuing (basically, discards + the message). RabbitMQ will not redeliver the message to any other + consumer, but a queue can be configured to send rejected messages to a + [dead letter exchange](https://www.rabbitmq.com/dlx.html), where another + consumer can see why it was dead lettered, how many times, etc, and + potentially republish it. * `:reject_and_requeue` - rejects the message and tells RabbitMQ to requeue it so - that it can be delivered to a consumer again. `:reject_and_requeue` always - requeues the message. + that it can be delivered to a consumer again. `:reject_and_requeue` + always requeues the message. If the message is unprocessable, this will + cause an infinite loop of retries. * `:reject_and_requeue_once` - rejects the message and tells RabbitMQ to requeue it the first time. If a message was already requeued and redelivered, it will be - rejected and not requeued again. + rejected and not requeued again. This feature uses Broadway-specific message metadata, + not RabbitMQ's dead lettering feature. ## Metadata