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-module(rabbit_channel_sup_sup).
9
10%% Supervisor for AMQP 0-9-1 channels. Every AMQP 0-9-1 connection has
11%% one of these.
12%%
13%% See also rabbit_channel_sup, rabbit_connection_helper_sup, rabbit_reader.
14
15-behaviour(supervisor2).
16
17-export([start_link/0, start_channel/2]).
18
19-export([init/1]).
20
21-include_lib("rabbit_common/include/rabbit.hrl").
22
23%%----------------------------------------------------------------------------
24
25-spec start_link() -> rabbit_types:ok_pid_or_error().
26
27start_link() ->
28    supervisor2:start_link(?MODULE, []).
29
30-spec start_channel(pid(), rabbit_channel_sup:start_link_args()) ->
31          {'ok', pid(), {pid(), any()}}.
32
33start_channel(Pid, Args) ->
34    supervisor2:start_child(Pid, [Args]).
35
36%%----------------------------------------------------------------------------
37
38init([]) ->
39    ?LG_PROCESS_TYPE(channel_sup_sup),
40    {ok, {{simple_one_for_one, 0, 1},
41          [{channel_sup, {rabbit_channel_sup, start_link, []},
42            temporary, infinity, supervisor, [rabbit_channel_sup]}]}}.
43