From 7cfb0178897e29bc057ce7d875250f9b427be3b2 Mon Sep 17 00:00:00 2001 From: Matteo Cafasso Date: Fri, 23 Nov 2018 22:25:44 +0200 Subject: [PATCH] rabbit_backing_queue: extend is_duplicate callback return values Allow the backing queue implementation to inform the amqqueue process how to proceed when a message duplicate is encountered. * {true, drop} the message is a duplicate and should be ignored * {true, reject} the message is a duplicate and the publisher should receive a rejection * false the message is not deemed a duplicate * true kept for backward compatibility, equivalent to {true, drop} Signed-off-by: Matteo Cafasso --- deps/rabbit_common/src/rabbit_backing_queue.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deps/rabbit_common/src/rabbit_backing_queue.erl b/deps/rabbit_common/src/rabbit_backing_queue.erl index b14d8a9857..951c4e0128 100644 --- a/deps/rabbit_common/src/rabbit_backing_queue.erl +++ b/deps/rabbit_common/src/rabbit_backing_queue.erl @@ -255,9 +255,9 @@ %% Called prior to a publish or publish_delivered call. Allows the BQ %% to signal that it's already seen this message, (e.g. it was published -%% or discarded previously) and thus the message should be dropped. +%% or discarded previously) specifying whether to drop the message or reject it. -callback is_duplicate(rabbit_types:basic_message(), state()) - -> {boolean(), state()}. + -> {{true, drop} | {true, reject} | boolean(), state()}. -callback set_queue_mode(queue_mode(), state()) -> state().