# `AMQP.Channel`
[🔗](https://github.com/pma/amqp/blob/v4.2.1/lib/amqp/channel.ex#L1)

Functions to operate on Channels.

# `channel_number`

```elixir
@type channel_number() :: non_neg_integer()
```

# `custom_consumer`

```elixir
@type custom_consumer() :: {module(), args :: any()}
```

# `t`

```elixir
@type t() :: %AMQP.Channel{
  channel_number: channel_number() | nil,
  conn: AMQP.Connection.t(),
  custom_consumer: custom_consumer() | nil,
  pid: pid()
}
```

# `close`

```elixir
@spec close(t()) :: :ok | {:error, AMQP.Basic.error()}
```

Closes an open Channel.

Please note that the closing will be performed asynchronously.
To verify the actual closure, you must monitor the process.

# `open`

```elixir
@spec open(AMQP.Connection.t(), custom_consumer() | nil, channel_number() | nil) ::
  {:ok, t()} | {:error, any()}
```

Opens a new Channel in a previously opened Connection.

Allows optionally to pass a `t:custom_consumer/0` to start a custom consumer
implementation. The consumer must implement the `:amqp_gen_consumer` behavior
from `:amqp_client`. See `:amqp_connection.open_channel/2` for more details
and `AMQP.DirectConsumer` for an example of a custom consumer.

Allows for a channel number to be passed as a third argument. See `:amqp_connection.open_channel/3`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
