Packages

Erlang CQRS/Event Sourcing framework built on erl-esdb

Current section

Files

Jump to
erl_evoq src erl_evoq_app.erl
Raw

src/erl_evoq_app.erl

%% @doc erl-evoq application module.
%%
%% Entry point for the erl-evoq CQRS/Event Sourcing framework.
%% Starts the top-level supervisor and initializes the pg groups
%% for aggregate registry and event routing.
%%
%% @author Macula.io
-module(erl_evoq_app).
-behaviour(application).
%% Application callbacks
-export([start/2, stop/1]).
%%====================================================================
%% Application callbacks
%%====================================================================
%% @doc Start the erl-evoq application.
-spec start(application:start_type(), term()) -> {ok, pid()} | {error, term()}.
start(_StartType, _StartArgs) ->
%% Ensure pg is started for aggregate registry
case pg:start_link(evoq_pg) of
{ok, _} -> ok;
{error, {already_started, _}} -> ok
end,
erl_evoq_sup:start_link().
%% @doc Stop the erl-evoq application.
-spec stop(term()) -> ok.
stop(_State) ->
ok.