forked from rzezeski/rebar_riak_core
-
Notifications
You must be signed in to change notification settings - Fork 2
/
riak_core_app.erl
30 lines (22 loc) · 958 Bytes
/
riak_core_app.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
-module({{appid}}_app).
-behaviour(application).
%% Application callbacks
-export([start/2, stop/1]).
%% ===================================================================
%% Application callbacks
%% ===================================================================
start(_StartType, _StartArgs) ->
case {{appid}}_sup:start_link() of
{ok, Pid} ->
ok = riak_core:register([{vnode_module, {{appid}}_vnode}]),
ok = riak_core_ring_events:add_guarded_handler({{appid}}_ring_event_handler, []),
ok = riak_core_node_watcher_events:add_guarded_handler({{appid}}_node_event_handler, []),
ok = riak_core_node_watcher:service_up({{appid}}, self()),
EntryRoute = {["{{appid}}", "ping"], {{appid}}_wm_ping, []},
webmachine_router:add_route(EntryRoute),
{ok, Pid};
{error, Reason} ->
{error, Reason}
end.
stop(_State) ->
ok.