1%% This Source Code Form is subject to the terms of the Mozilla Public
2%% License, v. 2.0. If a copy of the MPL was not distributed with this
3%% file, You can obtain one at https://mozilla.org/MPL/2.0/.
4%%
5%% Copyright (c) 2007-2021 VMware, Inc. or its affiliates.  All rights reserved.
6%%
7
8%% @private
9-module(amqp_channel_sup_sup).
10
11-include("amqp_client.hrl").
12
13-behaviour(supervisor2).
14
15-export([start_link/3, start_channel_sup/4]).
16-export([init/1]).
17
18%%---------------------------------------------------------------------------
19%% Interface
20%%---------------------------------------------------------------------------
21
22start_link(Type, Connection, ConnName) ->
23    supervisor2:start_link(?MODULE, [Type, Connection, ConnName]).
24
25start_channel_sup(Sup, InfraArgs, ChannelNumber, Consumer) ->
26    supervisor2:start_child(Sup, [InfraArgs, ChannelNumber, Consumer]).
27
28%%---------------------------------------------------------------------------
29%% supervisor2 callbacks
30%%---------------------------------------------------------------------------
31
32init([Type, Connection, ConnName]) ->
33    {ok, {{simple_one_for_one, 0, 1},
34          [{channel_sup,
35            {amqp_channel_sup, start_link, [Type, Connection, ConnName]},
36            temporary, infinity, supervisor, [amqp_channel_sup]}]}}.
37