emqx_kernel_sup.erl 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. %% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved.
  2. %%
  3. %% Licensed under the Apache License, Version 2.0 (the "License");
  4. %% you may not use this file except in compliance with the License.
  5. %% You may obtain a copy of the License at
  6. %%
  7. %% http://www.apache.org/licenses/LICENSE-2.0
  8. %%
  9. %% Unless required by applicable law or agreed to in writing, software
  10. %% distributed under the License is distributed on an "AS IS" BASIS,
  11. %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. %% See the License for the specific language governing permissions and
  13. %% limitations under the License.
  14. -module(emqx_kernel_sup).
  15. -behaviour(supervisor).
  16. -export([start_link/0]).
  17. -export([init/1]).
  18. start_link() ->
  19. supervisor:start_link({local, ?MODULE}, ?MODULE, []).
  20. init([]) ->
  21. {ok, {{one_for_one, 10, 100},
  22. [child_spec(emqx_pool, supervisor),
  23. child_spec(emqx_alarm_mgr, worker),
  24. child_spec(emqx_hooks, worker),
  25. child_spec(emqx_stats, worker),
  26. child_spec(emqx_metrics, worker),
  27. child_spec(emqx_ctl, worker),
  28. child_spec(emqx_zone, worker),
  29. child_spec(emqx_tracer, worker)]}}.
  30. child_spec(M, worker) ->
  31. #{id => M,
  32. start => {M, start_link, []},
  33. restart => permanent,
  34. shutdown => 5000,
  35. type => worker,
  36. modules => [M]};
  37. child_spec(M, supervisor) ->
  38. #{id => M,
  39. start => {M, start_link, []},
  40. restart => permanent,
  41. shutdown => infinity,
  42. type => supervisor,
  43. modules => [M]}.