Packages

OPCUA Erlang library

Current section

Files

Jump to
opcua src opcua_client_pool_sup.erl
Raw

src/opcua_client_pool_sup.erl

-module(opcua_client_pool_sup).
-behaviour(supervisor).
%%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% API functions
-export([start_link/0]).
-export([start_client/1]).
%% Behaviour supervisor callback functions
-export([init/1]).
%%% API FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
start_link() ->
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
start_client(Opts) ->
{ok, Pid} = supervisor:start_child(?MODULE, [Opts]),
Pid.
%%% BEHAVIOUR supervisor CALLBACK FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
init([]) ->
{ok, {#{strategy => simple_one_for_one}, [#{
id => undefined,
restart => permanent,
start => {opcua_client, start_link, []}
}]}}.