From 0d608be29cbf75ecfc88a7be962130f3a5a38137 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 9 Feb 2016 00:36:54 +0100 Subject: [stomp_sup] Add stomp_worker spec --- src/stomp.erl_app.erl | 11 ----------- src/stomp.erl_sup.erl | 12 ------------ src/stomp_app.erl | 11 +++++++++++ src/stomp_sup.erl | 22 ++++++++++++++++++++++ 4 files changed, 33 insertions(+), 23 deletions(-) delete mode 100644 src/stomp.erl_app.erl delete mode 100644 src/stomp.erl_sup.erl create mode 100644 src/stomp_app.erl create mode 100644 src/stomp_sup.erl diff --git a/src/stomp.erl_app.erl b/src/stomp.erl_app.erl deleted file mode 100644 index 78a6ecc92f2c..000000000000 --- a/src/stomp.erl_app.erl +++ /dev/null @@ -1,11 +0,0 @@ --module(stomp.erl_app). --behaviour(application). - --export([start/2]). --export([stop/1]). - -start(_Type, _Args) -> - stomp.erl_sup:start_link(). - -stop(_State) -> - ok. diff --git a/src/stomp.erl_sup.erl b/src/stomp.erl_sup.erl deleted file mode 100644 index 9c41cba1f202..000000000000 --- a/src/stomp.erl_sup.erl +++ /dev/null @@ -1,12 +0,0 @@ --module(stomp.erl_sup). --behaviour(supervisor). - --export([start_link/0]). --export([init/1]). - -start_link() -> - supervisor:start_link({local, ?MODULE}, ?MODULE, []). - -init([]) -> - Procs = [], - {ok, {{one_for_one, 1, 5}, Procs}}. diff --git a/src/stomp_app.erl b/src/stomp_app.erl new file mode 100644 index 000000000000..b7d889c3f485 --- /dev/null +++ b/src/stomp_app.erl @@ -0,0 +1,11 @@ +-module(stomp_app). +-behaviour(application). + +-export([start/2]). +-export([stop/1]). + +start(_Type, _Args) -> + stomp.erl_sup:start_link(). + +stop(_State) -> + ok. diff --git a/src/stomp_sup.erl b/src/stomp_sup.erl new file mode 100644 index 000000000000..96d4aafb9fba --- /dev/null +++ b/src/stomp_sup.erl @@ -0,0 +1,22 @@ +-module(stomp_sup). +-behaviour(supervisor). + +-export([start_link/0]). +-export([init/1]). + +start_link() -> + supervisor:start_link({local, ?MODULE}, ?MODULE, []). + +init([]) -> + Procs = [stomp_spec()], + {ok, {{one_for_one, 1, 5}, Procs}}. + +%% Private + +stomp_spec() -> + #{id => stomp_proc, + start => {stomp_worker, start_link, []}, + restart => permanent, + shutdown => 5000, + type => worker, + module => [stomp_worker]} -- cgit 1.4.1