diff options
| author | Luke Bakken <lbakken@pivotal.io> | 2021-01-07 09:38:25 -0800 |
|---|---|---|
| committer | Luke Bakken <lbakken@pivotal.io> | 2021-01-07 10:10:18 -0800 |
| commit | c75e39b5b5adb2054bbc3181fb1fa8d91b26d039 (patch) | |
| tree | f828df2b379f36a88a42faa3ce16fe331b9cb40a | |
| parent | 381259629e43a7bd6f08bdccac5b23bd7b23eb90 (diff) | |
| download | rabbitmq-server-git-c75e39b5b5adb2054bbc3181fb1fa8d91b26d039.tar.gz | |
Add parameter detection to rabbit_shovel_worker start_link
| -rw-r--r-- | deps/rabbitmq_shovel/src/rabbit_shovel_dyn_worker_sup_sup.erl | 8 | ||||
| -rw-r--r-- | deps/rabbitmq_shovel/src/rabbit_shovel_worker.erl | 11 |
2 files changed, 12 insertions, 7 deletions
diff --git a/deps/rabbitmq_shovel/src/rabbit_shovel_dyn_worker_sup_sup.erl b/deps/rabbitmq_shovel/src/rabbit_shovel_dyn_worker_sup_sup.erl index ba0f12df4b..6f94a8af62 100644 --- a/deps/rabbitmq_shovel/src/rabbit_shovel_dyn_worker_sup_sup.erl +++ b/deps/rabbitmq_shovel/src/rabbit_shovel_dyn_worker_sup_sup.erl @@ -50,14 +50,8 @@ child_exists(Name) -> stop_child(Name) -> case get({shovel_worker_autodelete, Name}) of - true -> - %% TODO rabbit_log_shovel:debug("@@@@@@@@ ~p:stop_child Name: ~p SKIPPING TERMINATE/DELETE", [?MODULE, Name]), - rabbit_log_shovel:debug("@@@@@@@@ ~p:stop_child Name: ~p DOING TERMINATE/DELETE", [?MODULE, Name]), - ok = mirrored_supervisor:terminate_child(?SUPERVISOR, Name), - ok = mirrored_supervisor:delete_child(?SUPERVISOR, Name), - ok; %% [1] + true -> ok; %% [1] _ -> - rabbit_log_shovel:debug("@@@@@@@@ ~p:stop_child Name: ~p DOING TERMINATE/DELETE", [?MODULE, Name]), ok = mirrored_supervisor:terminate_child(?SUPERVISOR, Name), ok = mirrored_supervisor:delete_child(?SUPERVISOR, Name), rabbit_shovel_status:remove(Name) diff --git a/deps/rabbitmq_shovel/src/rabbit_shovel_worker.erl b/deps/rabbitmq_shovel/src/rabbit_shovel_worker.erl index dc4d0d8959..0abf765f1c 100644 --- a/deps/rabbitmq_shovel/src/rabbit_shovel_worker.erl +++ b/deps/rabbitmq_shovel/src/rabbit_shovel_worker.erl @@ -27,9 +27,20 @@ %% [2] Counts down until we stop publishing in on-confirm mode start_link(Type, Name, Config) -> + ShovelParameter = get_shovel_parameter(Name), + maybe_start_link(ShovelParameter, Type, Name, Config). + +maybe_start_link(not_found, _Type, Name, _Config) -> + {error, not_found}; +maybe_start_link(_, Type, Name, Config) -> ok = rabbit_shovel_status:report(Name, Type, starting), gen_server2:start_link(?MODULE, [Type, Name, Config], []). +get_shovel_parameter({VHost, ShovelName}) -> + rabbit_runtime_parameters:lookup(VHost, <<"shovel">>, ShovelName); +get_shovel_parameter(ShovelName) -> + rabbit_runtime_parameters:lookup(<<"/">>, <<"shovel">>, ShovelName). + %%--------------------------- %% Gen Server Implementation %%--------------------------- |
