Current section
Files
Jump to
Current section
Files
src/opcua_server_session_pool_sup.erl
-module(opcua_server_session_pool_sup).
-behaviour(supervisor).
%%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% API functions
-export([start_link/0]).
-export([start_session/2]).
%% Behaviour supervisor callback functions
-export([init/1]).
%%% MACROS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-define(SERVER, ?MODULE).
%%% API FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
start_link() ->
supervisor:start_link({local, ?SERVER}, ?MODULE, []).
start_session(SessId, AuthToken) ->
supervisor:start_child(?SERVER, [SessId, AuthToken]).
%%% BEHAVIOUR supervisor CALLBACK FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
init([]) ->
SupFlags = #{strategy => simple_one_for_one},
SessionSpec = #{
id => undefined,
restart => temporary,
start => {opcua_server_session, start_link, []}
},
{ok, {SupFlags, [SessionSpec]}}.