Add emqx_boot module
This commit is contained in:
parent
3038bd4570
commit
6e18f8543d
|
@ -35,10 +35,10 @@ start(_Type, _Args) ->
|
|||
ok = emqx_modules:load(),
|
||||
ok = emqx_plugins:init(),
|
||||
emqx_plugins:load(),
|
||||
ok = emqx_listeners:start(),
|
||||
emqx_boot:is_enabled(listeners)
|
||||
andalso (ok = emqx_listeners:start()),
|
||||
start_autocluster(),
|
||||
register(emqx, self()),
|
||||
|
||||
emqx_alarm_handler:load(),
|
||||
print_vsn(),
|
||||
{ok, Sup}.
|
||||
|
@ -46,7 +46,8 @@ start(_Type, _Args) ->
|
|||
-spec(stop(State :: term()) -> term()).
|
||||
stop(_State) ->
|
||||
emqx_alarm_handler:unload(),
|
||||
emqx_listeners:stop(),
|
||||
emqx_boot:is_enabled(listeners)
|
||||
andalso emqx_listeners:stop(),
|
||||
emqx_modules:unload().
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
|
|
|
@ -62,18 +62,21 @@ stop_child(ChildId) ->
|
|||
%%--------------------------------------------------------------------
|
||||
|
||||
init([]) ->
|
||||
%% Kernel Sup
|
||||
KernelSup = child_spec(emqx_kernel_sup, supervisor),
|
||||
%% Router Sup
|
||||
RouterSup = child_spec(emqx_router_sup, supervisor),
|
||||
%% Broker Sup
|
||||
BrokerSup = child_spec(emqx_broker_sup, supervisor),
|
||||
%% CM Sup
|
||||
CMSup = child_spec(emqx_cm_sup, supervisor),
|
||||
%% Sys Sup
|
||||
SysSup = child_spec(emqx_sys_sup, supervisor),
|
||||
{ok, {{one_for_all, 0, 1},
|
||||
[KernelSup, RouterSup, BrokerSup, CMSup, SysSup]}}.
|
||||
Childs = [KernelSup] ++
|
||||
[RouterSup || emqx_boot:is_enabled(router)] ++
|
||||
[BrokerSup || emqx_boot:is_enabled(broker)] ++
|
||||
[CMSup || emqx_boot:is_enabled(broker)] ++
|
||||
[SysSup],
|
||||
SupFlags = #{strategy => one_for_all,
|
||||
intensity => 0,
|
||||
period => 1
|
||||
},
|
||||
{ok, {SupFlags, Childs}}.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Internal functions
|
||||
|
|
Loading…
Reference in New Issue