|
15 | 15 | gen_unique_name/2,
|
16 | 16 | decl_fun/2]).
|
17 | 17 |
|
| 18 | +-export([ |
| 19 | + dynamic_shovel_supervisor_mod/0 |
| 20 | +]). |
| 21 | + |
18 | 22 | -include_lib("rabbit_common/include/rabbit_framing.hrl").
|
19 | 23 | -include_lib("rabbit_common/include/rabbit.hrl").
|
20 | 24 | -include_lib("kernel/include/logger.hrl").
|
|
23 | 27 | -define(ROUTING_HEADER, <<"x-shovelled">>).
|
24 | 28 | -define(TIMESTAMP_HEADER, <<"x-shovelled-timestamp">>).
|
25 | 29 |
|
| 30 | +-spec dynamic_shovel_supervisor_mod() -> module(). |
| 31 | +dynamic_shovel_supervisor_mod() -> |
| 32 | + rabbit_shovel_dyn_worker_sup_sup. |
| 33 | + |
26 | 34 | update_headers(Prefix, Suffix, SrcURI, DestURI,
|
27 | 35 | Props = #'P_basic'{headers = Headers}) ->
|
28 | 36 | Table = Prefix ++ [{<<"src-uri">>, SrcURI},
|
@@ -92,9 +100,10 @@ restart_shovel(VHost, Name) ->
|
92 | 100 | not_found ->
|
93 | 101 | {error, not_found};
|
94 | 102 | _Obj ->
|
| 103 | + Mod = dynamic_shovel_supervisor_mod(), |
95 | 104 | ?LOG_INFO("Shovel '~ts' in virtual host '~ts' will be restarted", [Name, VHost]),
|
96 |
| - ok = rabbit_shovel_dyn_worker_sup_sup:stop_child({VHost, Name}), |
97 |
| - {ok, _} = rabbit_shovel_dyn_worker_sup_sup:start_link(), |
| 105 | + ok = Mod:stop_child({VHost, Name}), |
| 106 | + {ok, _} = Mod:start_link(), |
98 | 107 | ok
|
99 | 108 | end.
|
100 | 109 |
|
|
0 commit comments