/
notify.erl
44 lines (38 loc) · 1.21 KB
/
notify.erl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
%%%-------------------------------------------------------------------
%%% @author James Aimonetti <james@2600hz.org>
%%% @copyright (C) 2011, VoIP, INC
%%% @doc
%%% Various ways to notify things of stuff
%%% @end
%%% Created : 3 May 2011 by James Aimonetti <james@2600hz.org>
%%%-------------------------------------------------------------------
-module(notify).
-author('James Aimonetti <james@2600hz.org>').
-export([start/0, start_link/0, stop/0]).
%% @spec start_link() -> {ok,Pid::pid()}
%% @doc Starts the app for inclusion in a supervisor tree
start_link() ->
start_deps(),
notify_sup:start_link().
%% @spec start() -> ok
%% @doc Start the app
start() ->
start_deps(),
application:start(notify).
start_deps() ->
whistle_apps_deps:ensure(?MODULE), % if started by the whistle_controller, this will exist
ensure_started(sasl), % logging
ensure_started(crypto), % random
ensure_started(whistle_amqp), % amqp wrapper
ensure_started(whistle_couch). % couch wrapper
%% @spec stop() -> ok
%% @doc Stop the basicapp server.
stop() ->
ok = application:stop(notify).
ensure_started(App) ->
case application:start(App) of
ok ->
ok;
{error, {already_started, App}} ->
ok
end.