|
39 | 39 | %% from and can break with the next upgrade. It should not be used by
|
40 | 40 | %% another one that the one who created it or survive a node restart.
|
41 | 41 | %% Thus, function references have been replace by the following MFA.
|
42 |
| --export([decl_fun/3, publish_fun/4]). |
| 42 | +-export([decl_fun/3, publish_fun/4, props_fun_timestamp_header/4, |
| 43 | + props_fun_forward_header/5]). |
43 | 44 |
|
44 | 45 | -define(MAX_CONNECTION_CLOSE_TIMEOUT, 10000).
|
45 | 46 |
|
@@ -559,23 +560,25 @@ field_map(Fields, Idx0) ->
|
559 | 560 | fail(Reason) -> throw({error, Reason}).
|
560 | 561 |
|
561 | 562 | add_forward_headers_fun(Name, true, PubProps) ->
|
562 |
| - fun(SrcUri, DestUri, Props) -> |
563 |
| - rabbit_shovel_util:update_headers( |
564 |
| - [{<<"shovelled-by">>, rabbit_nodes:cluster_name()}, |
565 |
| - {<<"shovel-type">>, <<"static">>}, |
566 |
| - {<<"shovel-name">>, list_to_binary(atom_to_list(Name))}], |
567 |
| - [], SrcUri, DestUri, PubProps(SrcUri, DestUri, Props)) |
568 |
| - end; |
| 563 | + {?MODULE, props_fun_forward_header, [Name, PubProps]}; |
569 | 564 | add_forward_headers_fun(_Name, false, PubProps) ->
|
570 | 565 | PubProps.
|
571 | 566 |
|
| 567 | +props_fun_forward_header(Name, {M, F, Args}, SrcUri, DestUri, Props) -> |
| 568 | + rabbit_shovel_util:update_headers( |
| 569 | + [{<<"shovelled-by">>, rabbit_nodes:cluster_name()}, |
| 570 | + {<<"shovel-type">>, <<"static">>}, |
| 571 | + {<<"shovel-name">>, list_to_binary(atom_to_list(Name))}], |
| 572 | + [], SrcUri, DestUri, apply(M, F, Args ++ [SrcUri, DestUri, Props])). |
| 573 | + |
572 | 574 | add_timestamp_header_fun(true, PubProps) ->
|
573 |
| - fun(SrcUri, DestUri, Props) -> |
574 |
| - rabbit_shovel_util:add_timestamp_header( |
575 |
| - PubProps(SrcUri, DestUri, Props)) |
576 |
| - end; |
| 575 | + {?MODULE, props_fun_timestamp_header, [PubProps]}; |
577 | 576 | add_timestamp_header_fun(false, PubProps) -> PubProps.
|
578 | 577 |
|
| 578 | +props_fun_timestamp_header({M, F, Args}, SrcUri, DestUri, Props) -> |
| 579 | + rabbit_shovel_util:add_timestamp_header( |
| 580 | + apply(M, F, Args ++ [SrcUri, DestUri, Props])). |
| 581 | + |
579 | 582 | parse_declaration({[], Acc}) ->
|
580 | 583 | Acc;
|
581 | 584 | parse_declaration({[{Method, Props} | Rest], Acc}) when is_list(Props) ->
|
|
0 commit comments