summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Klishin <michael@clojurewerkz.org>2018-05-10 13:43:39 -0500
committerMichael Klishin <michael@clojurewerkz.org>2018-05-10 13:43:39 -0500
commit54c9b85836199597fb3b633fdeb2d725ab9d45ad (patch)
treebb5a0da51de81e8724f2968211cd1ee4b4e0edbe
parent117eb9bd268b8b8a47fb1e3478575a2a380227c4 (diff)
downloadrabbitmq-server-git-54c9b85836199597fb3b633fdeb2d725ab9d45ad.tar.gz
Make policy validation aware of the max-priority argument
References #1590. [#157380396]
-rw-r--r--src/rabbit_policies.erl8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/rabbit_policies.erl b/src/rabbit_policies.erl
index f48189b210..0faad7259d 100644
--- a/src/rabbit_policies.erl
+++ b/src/rabbit_policies.erl
@@ -41,6 +41,7 @@ register() ->
{policy_validator, <<"expires">>},
{policy_validator, <<"max-length">>},
{policy_validator, <<"max-length-bytes">>},
+ {policy_validator, <<"max-priority">>},
{policy_validator, <<"queue-mode">>},
{policy_validator, <<"overflow">>},
{operator_policy_validator, <<"expires">>},
@@ -100,6 +101,12 @@ validate_policy0(<<"max-length-bytes">>, Value)
validate_policy0(<<"max-length-bytes">>, Value) ->
{error, "~p is not a valid maximum length in bytes", [Value]};
+validate_policy0(<<"max-priority">>, Value)
+ when is_integer(Value), Value >= 0, Value =< 255 ->
+ ok;
+validate_policy0(<<"max-priority">>, Value) ->
+ {error, "~p is not a valid max priority (must be an integer in the 1-255 range)", [Value]};
+
validate_policy0(<<"queue-mode">>, <<"default">>) ->
ok;
validate_policy0(<<"queue-mode">>, <<"lazy">>) ->
@@ -117,4 +124,3 @@ merge_policy_value(<<"message-ttl">>, Val, OpVal) -> min(Val, OpVal);
merge_policy_value(<<"max-length">>, Val, OpVal) -> min(Val, OpVal);
merge_policy_value(<<"max-length-bytes">>, Val, OpVal) -> min(Val, OpVal);
merge_policy_value(<<"expires">>, Val, OpVal) -> min(Val, OpVal).
-