From 6c7990715c6688248405087d37b7196ea2bc52ad Mon Sep 17 00:00:00 2001 From: Simon Unge Date: Fri, 3 May 2024 18:41:59 +0000 Subject: [PATCH 1/2] Added global default queue type config (cherry picked from commit 2e2bbaff33dc3fd5d53bdbbd9cf63d9079f6601d) (cherry picked from commit 9942db514abc11d289d41e695af3e53348dd1736) --- deps/rabbit/priv/schema/rabbit.schema | 4 ++++ deps/rabbit/src/rabbit_queue_type.erl | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/deps/rabbit/priv/schema/rabbit.schema b/deps/rabbit/priv/schema/rabbit.schema index fc4766b9f2ae..d88aafba77d1 100644 --- a/deps/rabbit/priv/schema/rabbit.schema +++ b/deps/rabbit/priv/schema/rabbit.schema @@ -2478,6 +2478,10 @@ end}. end }. +{mapping, "default_queue_type", "rabbit.default_queue_type", [ + {datatype, {enum, [quorum, classic, stream]}}]}. + + %% %% Backing queue version %% diff --git a/deps/rabbit/src/rabbit_queue_type.erl b/deps/rabbit/src/rabbit_queue_type.erl index d69edcf37c71..703b8ad5a7a6 100644 --- a/deps/rabbit/src/rabbit_queue_type.erl +++ b/deps/rabbit/src/rabbit_queue_type.erl @@ -237,7 +237,15 @@ feature_flag_name(_) -> undefined. default() -> - rabbit_classic_queue. + case rabbit_misc:get_env(rabbit, + default_queue_type, + classic) + of + quorum -> rabbit_quorum_queue; + classic -> rabbit_classic_queue; + stream -> rabbit_stream_queue; + _ -> rabbit_classic_queue + end. %% is a specific queue type implementation enabled -spec is_enabled(module()) -> boolean(). From 88e6b442cd02acaf074357c5b42729ff037f6456 Mon Sep 17 00:00:00 2001 From: Simon Unge Date: Fri, 3 May 2024 19:18:21 +0000 Subject: [PATCH 2/2] Changed schema logic (cherry picked from commit ad69f5b506addd08b9856e5faeb9023f51150f61) (cherry picked from commit d403b402b51b37641151c348e845c27889337a9f) --- deps/rabbit/priv/schema/rabbit.schema | 14 +++++++++++++- deps/rabbit/src/rabbit_queue_type.erl | 12 +++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/deps/rabbit/priv/schema/rabbit.schema b/deps/rabbit/priv/schema/rabbit.schema index d88aafba77d1..225d5fba6016 100644 --- a/deps/rabbit/priv/schema/rabbit.schema +++ b/deps/rabbit/priv/schema/rabbit.schema @@ -2479,7 +2479,19 @@ end}. }. {mapping, "default_queue_type", "rabbit.default_queue_type", [ - {datatype, {enum, [quorum, classic, stream]}}]}. + {datatype, atom} +]}. + +{translation, "rabbit.default_queue_type", +fun(Conf) -> + case cuttlefish:conf_get("default_queue_type", Conf, rabbit_classic_queue) of + classic -> rabbit_classic_queue; + quorum -> rabbit_quorum_queue; + stream -> rabbit_stream_queue; + Module -> Module + end +end}. + %% diff --git a/deps/rabbit/src/rabbit_queue_type.erl b/deps/rabbit/src/rabbit_queue_type.erl index 703b8ad5a7a6..c4e0c7c5d3ae 100644 --- a/deps/rabbit/src/rabbit_queue_type.erl +++ b/deps/rabbit/src/rabbit_queue_type.erl @@ -237,15 +237,9 @@ feature_flag_name(_) -> undefined. default() -> - case rabbit_misc:get_env(rabbit, - default_queue_type, - classic) - of - quorum -> rabbit_quorum_queue; - classic -> rabbit_classic_queue; - stream -> rabbit_stream_queue; - _ -> rabbit_classic_queue - end. + rabbit_misc:get_env(rabbit, + default_queue_type, + rabbit_classic_queue). %% is a specific queue type implementation enabled -spec is_enabled(module()) -> boolean().