View Source WhiteRabbit.Channel (White Rabbit v0.2.0)

WhiteRabbit AMQP channel GenServer.

Starts an %AMQP.Channel{} process with the given WhiteRabbit.Connection GenServer and registers it to a WhiteRabbit.ChannelRegistry to allow other process to grab open amqp channels from the registry and use them.

Backoff on failed channel open. Tries to re-open parent connection and open channel again.

Link to this section Summary

Types

t()

%WhiteRabbit.Channel{} struct that defines the nessecary config for creating channel GenServers.

Functions

Returns a specification to start this module under a supervisor.

Start an %AMQP.Channel{} process with the given config connection.

Link to this section Types

@type t() :: %WhiteRabbit.Channel{
  connection: atom(),
  counter_agent: pid(),
  name: atom()
}

%WhiteRabbit.Channel{} struct that defines the nessecary config for creating channel GenServers.

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

start_amqp_channel(channel_config, channel_registry \\ WhiteRabbit.ChannelRegistry)

View Source

Start an %AMQP.Channel{} process with the given config connection.

Calls the WhiteRabbit.Connection Genserver registered under the connection atom to get the connection state and pid.

If succussful, will try to open a %AMQP.Channel{} on the connection and then register the channel to a supervised registry.

If a nil connection is returned, then retry opening the parent connection and this channel.

The retry backoff is in the form of 5000 + 1000 * current_backoff_number

Always return a {:ok, {_, _}} tuple so the GenServer will always start.