@@ -2658,14 +2658,17 @@ end}.
2658
2658
{mapping , " message_interceptors.incoming.$interceptor.overwrite" , " rabbit.incoming_message_interceptors" , [
2659
2659
{datatype , {enum , [true , false ]}}]}.
2660
2660
2661
- % Pseudo-key to include the interceptor in the list of interceptors.
2661
+ % Pseudo-key to include the interceptor in the list of interceptors.
2662
2662
% - If any other configuration is provided for the interceptor this
2663
- % configuration is not required.
2663
+ % configuration is not required.
2664
2664
% - If no other configuration is provided, this one is required so that the
2665
- % interceptor gets invoked.
2665
+ % interceptor gets invoked.
2666
2666
{mapping , " message_interceptors.incoming.$interceptor.enabled" , " rabbit.incoming_message_interceptors" , [
2667
2667
{datatype , {enum , [true ]}}]}.
2668
2668
2669
+ {mapping , " message_interceptors.outgoing.$interceptor.enabled" , " rabbit.outgoing_message_interceptors" , [
2670
+ {datatype , {enum , [true ]}}]}.
2671
+
2669
2672
{mapping , " message_interceptors.incoming.set_header_timestamp.overwrite" , " rabbit.incoming_message_interceptors" , [
2670
2673
{datatype , {enum , [true , false ]}}]}.
2671
2674
@@ -2674,19 +2677,21 @@ end}.
2674
2677
2675
2678
{translation , " rabbit.incoming_message_interceptors" ,
2676
2679
fun (Conf ) ->
2677
- case cuttlefish_variable :filter_by_prefix (" message_interceptors.incoming" , Conf ) of
2678
- [] ->
2679
- cuttlefish :unset ();
2680
- L ->
2681
- InterceptorsConfig = [
2680
+ case cuttlefish_variable :filter_by_prefix (" message_interceptors.incoming" , Conf ) of
2681
+ [] ->
2682
+ cuttlefish :unset ();
2683
+ L ->
2684
+ InterceptorsConfig = [
2682
2685
{Module0 , Config , Value }
2683
2686
|| {[" message_interceptors" , " incoming" , Module0 , Config ], Value } <- L
2684
2687
],
2685
2688
{Result , Order0 } = lists :foldl (
2686
- fun ({Interceptor0 , Key0 , Value }, {Acc , Order }) ->
2689
+ fun ({Interceptor0 , Key0 , Value }, {Acc , Order }) ->
2687
2690
Interceptor = list_to_atom (Interceptor0 ),
2688
2691
Key = list_to_atom (Key0 ),
2689
- MapPutFun = fun (Key , Value ) -> fun (Old ) -> maps :put (Key , Value , Old ) end end ,
2692
+ MapPutFun = fun (Old ) -> maps :put (Key , Value , Old ) end ,
2693
+ % This Interceptor -> Module alias exists for
2694
+ % compatibility reasons
2690
2695
Module = case Interceptor of
2691
2696
set_header_timestamp ->
2692
2697
rabbit_header_timestamp_interceptor ;
@@ -2695,10 +2700,10 @@ end}.
2695
2700
_ ->
2696
2701
Interceptor
2697
2702
end ,
2698
- NewAcc =
2703
+ NewAcc =
2699
2704
maps :update_with (
2700
- Module ,
2701
- MapPutFun ( Key , Value ),
2705
+ Module ,
2706
+ MapPutFun ,
2702
2707
#{Key => Value },
2703
2708
Acc ),
2704
2709
{NewAcc , [Module | Order ]}
@@ -2708,7 +2713,39 @@ end}.
2708
2713
),
2709
2714
Order = lists :uniq (Order0 ),
2710
2715
[{O , maps :without ([enabled ], maps :get (O , Result ))} || O <- Order ]
2711
- end
2716
+ end
2717
+ end
2718
+ }.
2719
+
2720
+ {translation , " rabbit.outgoing_message_interceptors" ,
2721
+ fun (Conf ) ->
2722
+ case cuttlefish_variable :filter_by_prefix (" message_interceptors.outgoing" , Conf ) of
2723
+ [] ->
2724
+ cuttlefish :unset ();
2725
+ L ->
2726
+ InterceptorsConfig = [
2727
+ {Module0 , Config , Value }
2728
+ || {[" message_interceptors" , " outgoing" , Module0 , Config ], Value } <- L
2729
+ ],
2730
+ {Result , Order0 } = lists :foldl (
2731
+ fun ({Interceptor0 , Key0 , Value }, {Acc , Order }) ->
2732
+ Module = list_to_atom (Interceptor0 ),
2733
+ Key = list_to_atom (Key0 ),
2734
+ MapPutFun = fun (Old ) -> maps :put (Key , Value , Old ) end ,
2735
+ NewAcc =
2736
+ maps :update_with (
2737
+ Module ,
2738
+ MapPutFun ,
2739
+ #{Key => Value },
2740
+ Acc ),
2741
+ {NewAcc , [Module | Order ]}
2742
+ end ,
2743
+ {#{}, []},
2744
+ InterceptorsConfig
2745
+ ),
2746
+ Order = lists :uniq (Order0 ),
2747
+ [{O , maps :without ([enabled ], maps :get (O , Result ))} || O <- Order ]
2748
+ end
2712
2749
end
2713
2750
}.
2714
2751
0 commit comments