summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rabbit_client_sup.erl12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/rabbit_client_sup.erl b/src/rabbit_client_sup.erl
index 9602c51248..7cc11fef57 100644
--- a/src/rabbit_client_sup.erl
+++ b/src/rabbit_client_sup.erl
@@ -18,7 +18,7 @@
-behaviour(supervisor2).
--export([start_link/1, start_link/2]).
+-export([start_link/1, start_link/2, start_link_worker/2]).
-export([init/1]).
@@ -32,6 +32,8 @@
rabbit_types:ok_pid_or_error()).
-spec(start_link/2 :: ({'local', atom()}, rabbit_types:mfargs()) ->
rabbit_types:ok_pid_or_error()).
+-spec(start_link_worker/2 :: ({'local', atom()}, rabbit_types:mfargs()) ->
+ rabbit_types:ok_pid_or_error()).
-endif.
@@ -43,6 +45,12 @@ start_link(Callback) ->
start_link(SupName, Callback) ->
supervisor2:start_link(SupName, ?MODULE, Callback).
+start_link_worker(SupName, Callback) ->
+ supervisor2:start_link(SupName, ?MODULE, {Callback, worker}).
+
init({M,F,A}) ->
{ok, {{simple_one_for_one_terminate, 0, 1},
- [{client, {M,F,A}, temporary, infinity, supervisor, [M]}]}}.
+ [{client, {M,F,A}, temporary, infinity, supervisor, [M]}]}};
+init({{M,F,A}, worker}) ->
+ {ok, {{simple_one_for_one_terminate, 0, 1},
+ [{client, {M,F,A}, temporary, ?MAX_WAIT, worker, [M]}]}}.