@@ -316,26 +316,31 @@ declare_queue_error(Error, Queue, Leader, ActingUser) ->
316316ra_machine (Q ) ->
317317 {module , rabbit_fifo , ra_machine_config (Q )}.
318318
319- gather_policy_config (Q , ShouldLog ) ->
319+ gather_policy_config (Q , IsQueueDeclaration ) ->
320320 QName = amqqueue :get_name (Q ),
321321 % % take the minimum value of the policy and the queue arg if present
322322 MaxLength = args_policy_lookup (<<" max-length" >>, fun min /2 , Q ),
323323 OverflowBin = args_policy_lookup (<<" overflow" >>, fun policy_has_precedence /2 , Q ),
324- Overflow = overflow (OverflowBin , drop_head , QName , ShouldLog ),
324+ Overflow = overflow (OverflowBin , drop_head , QName ),
325325 MaxBytes = args_policy_lookup (<<" max-length-bytes" >>, fun min /2 , Q ),
326326 DeliveryLimit = case args_policy_lookup (<<" delivery-limit" >>,
327327 fun resolve_delivery_limit /2 , Q ) of
328328 undefined ->
329- maybe_log (ShouldLog , info ,
330- " ~ts : delivery_limit not set, defaulting to ~b " ,
331- [rabbit_misc :rs (QName ), ? DEFAULT_DELIVERY_LIMIT ]),
329+ case IsQueueDeclaration of
330+ true ->
331+ rabbit_log :info (
332+ " ~ts : delivery_limit not set, defaulting to ~b " ,
333+ [rabbit_misc :rs (QName ), ? DEFAULT_DELIVERY_LIMIT ]);
334+ false ->
335+ ok
336+ end ,
332337 ? DEFAULT_DELIVERY_LIMIT ;
333338 DL ->
334339 DL
335340 end ,
336341 Expires = args_policy_lookup (<<" expires" >>, fun min /2 , Q ),
337342 MsgTTL = args_policy_lookup (<<" message-ttl" >>, fun min /2 , Q ),
338- DeadLetterHandler = dead_letter_handler (Q , Overflow , ShouldLog ),
343+ DeadLetterHandler = dead_letter_handler (Q , Overflow ),
339344 #{dead_letter_handler => DeadLetterHandler ,
340345 max_length => MaxLength ,
341346 max_bytes => MaxBytes ,
@@ -348,7 +353,7 @@ gather_policy_config(Q, ShouldLog) ->
348353 }.
349354
350355ra_machine_config (Q ) when ? is_amqqueue (Q ) ->
351- PolicyConfig = gather_policy_config (Q , _ShouldLog = true ),
356+ PolicyConfig = gather_policy_config (Q , true ),
352357 QName = amqqueue :get_name (Q ),
353358 {Name , _ } = amqqueue :get_pid (Q ),
354359 PolicyConfig #{
@@ -721,15 +726,15 @@ system_recover(quorum_queues) ->
721726 end .
722727
723728maybe_apply_policies (Q , #{config := CurrentConfig }) ->
724- NewPolicyConfig = gather_policy_config (Q , _ShoudLog = false ),
729+ NewPolicyConfig = gather_policy_config (Q , false ),
725730
726731 RelevantKeys = maps :keys (NewPolicyConfig ),
727732 CurrentPolicyConfig = maps :with (RelevantKeys , CurrentConfig ),
728733
729734 ShouldUpdate = NewPolicyConfig =/= CurrentPolicyConfig ,
730735 case ShouldUpdate of
731736 true ->
732- rabbit_log :debug (" Re-applying policies to ~p " , [amqqueue :get_name (Q )]),
737+ rabbit_log :debug (" Re-applying policies to ~ts " , [rabbit_misc : rs ( amqqueue :get_name (Q ) )]),
733738 policy_changed (Q ),
734739 ok ;
735740 false -> ok
@@ -1557,35 +1562,35 @@ reclaim_memory(Vhost, QueueName) ->
15571562 ra_log_wal :force_roll_over ({? RA_WAL_NAME , Node }).
15581563
15591564% %----------------------------------------------------------------------------
1560- dead_letter_handler (Q , Overflow , ShouldLog ) ->
1565+ dead_letter_handler (Q , Overflow ) ->
15611566 Exchange = args_policy_lookup (<<" dead-letter-exchange" >>, fun queue_arg_has_precedence /2 , Q ),
15621567 RoutingKey = args_policy_lookup (<<" dead-letter-routing-key" >>, fun queue_arg_has_precedence /2 , Q ),
15631568 Strategy = args_policy_lookup (<<" dead-letter-strategy" >>, fun queue_arg_has_precedence /2 , Q ),
15641569 QName = amqqueue :get_name (Q ),
1565- dlh (Exchange , RoutingKey , Strategy , Overflow , QName , ShouldLog ).
1570+ dlh (Exchange , RoutingKey , Strategy , Overflow , QName ).
15661571
1567- dlh (undefined , undefined , undefined , _ , _ , _ ) ->
1572+ dlh (undefined , undefined , undefined , _ , _ ) ->
15681573 undefined ;
1569- dlh (undefined , RoutingKey , undefined , _ , QName , ShouldLog ) ->
1570- maybe_log ( ShouldLog , warning , " Disabling dead-lettering for ~ts despite configured dead-letter-routing-key '~ts ' "
1574+ dlh (undefined , RoutingKey , undefined , _ , QName ) ->
1575+ rabbit_log : warning ( " Disabling dead-lettering for ~ts despite configured dead-letter-routing-key '~ts ' "
15711576 " because dead-letter-exchange is not configured." ,
15721577 [rabbit_misc :rs (QName ), RoutingKey ]),
15731578 undefined ;
1574- dlh (undefined , _ , Strategy , _ , QName , ShouldLog ) ->
1575- maybe_log ( ShouldLog , warning , " Disabling dead-lettering for ~ts despite configured dead-letter-strategy '~ts ' "
1579+ dlh (undefined , _ , Strategy , _ , QName ) ->
1580+ rabbit_log : warning ( " Disabling dead-lettering for ~ts despite configured dead-letter-strategy '~ts ' "
15761581 " because dead-letter-exchange is not configured." ,
15771582 [rabbit_misc :rs (QName ), Strategy ]),
15781583 undefined ;
1579- dlh (_ , _ , <<" at-least-once" >>, reject_publish , _ , _ ) ->
1584+ dlh (_ , _ , <<" at-least-once" >>, reject_publish , _ ) ->
15801585 at_least_once ;
1581- dlh (Exchange , RoutingKey , <<" at-least-once" >>, drop_head , QName , ShouldLog ) ->
1582- maybe_log ( ShouldLog , warning , " Falling back to dead-letter-strategy at-most-once for ~ts "
1586+ dlh (Exchange , RoutingKey , <<" at-least-once" >>, drop_head , QName ) ->
1587+ rabbit_log : warning ( " Falling back to dead-letter-strategy at-most-once for ~ts "
15831588 " because configured dead-letter-strategy at-least-once is incompatible with "
15841589 " effective overflow strategy drop-head. To enable dead-letter-strategy "
15851590 " at-least-once, set overflow strategy to reject-publish." ,
15861591 [rabbit_misc :rs (QName )]),
15871592 dlh_at_most_once (Exchange , RoutingKey , QName );
1588- dlh (Exchange , RoutingKey , _ , _ , QName , _ ) ->
1593+ dlh (Exchange , RoutingKey , _ , _ , QName ) ->
15891594 dlh_at_most_once (Exchange , RoutingKey , QName ).
15901595
15911596dlh_at_most_once (Exchange , RoutingKey , QName ) ->
@@ -1940,11 +1945,11 @@ update_type_state(Q, Fun) when ?is_amqqueue(Q) ->
19401945 Ts = amqqueue :get_type_state (Q ),
19411946 amqqueue :set_type_state (Q , Fun (Ts )).
19421947
1943- overflow (undefined , Def , _QName , _ShouldLog ) -> Def ;
1944- overflow (<<" reject-publish" >>, _Def , _QName , _ShouldLog ) -> reject_publish ;
1945- overflow (<<" drop-head" >>, _Def , _QName , _ShouldLog ) -> drop_head ;
1946- overflow (<<" reject-publish-dlx" >> = V , Def , QName , ShouldLog ) ->
1947- maybe_log ( ShouldLog , warning , " Invalid overflow strategy ~tp for quorum queue: ~ts " ,
1948+ overflow (undefined , Def , _QName ) -> Def ;
1949+ overflow (<<" reject-publish" >>, _Def , _QName ) -> reject_publish ;
1950+ overflow (<<" drop-head" >>, _Def , _QName ) -> drop_head ;
1951+ overflow (<<" reject-publish-dlx" >> = V , Def , QName ) ->
1952+ rabbit_log : warning ( " Invalid overflow strategy ~tp for quorum queue: ~ts " ,
19481953 [V , rabbit_misc :rs (QName )]),
19491954 Def .
19501955
@@ -2092,7 +2097,3 @@ file_handle_other_reservation() ->
20922097file_handle_release_reservation () ->
20932098 ok .
20942099
2095- maybe_log (true , Level , Msg , Args ) ->
2096- rabbit_log :Level (Msg , Args );
2097- maybe_log (false , _ , _ , _ ) ->
2098- ok .
0 commit comments