ex_rabbit_pool v1.0.2 ExRabbitPool View Source
Link to this section Summary
Functions
Puts back a RabbitMQ channel into its corresponding connection worker
Gets a RabbitMQ channel out of a connection worker
Gets a connection from a connection worker so any client can exec commands manually
Retrieve a connection worker - we don't care about isolating access to each worker - we use a pool purely in order to spread load (pool config strategy :fifo)
Executes function f in the context of a channel, takes a connection worker out of the pool, put that connection worker back into the pool so any other concurrent client can have access to it, checks out a channel out of the worker's channel pool, executes the function with the result of the checkout and finally puts the channel back into the worker's pool.
Link to this section Types
f()
View Source
f() ::
({:ok, AMQP.Channel.t()} | {:error, :disconnected | :out_of_channels} ->
any())
f() ::
({:ok, AMQP.Channel.t()} | {:error, :disconnected | :out_of_channels} ->
any())
Link to this section Functions
checkin_channel(conn_worker, channel)
View Source
checkin_channel(pid(), AMQP.Channel.t()) :: :ok
checkin_channel(pid(), AMQP.Channel.t()) :: :ok
Puts back a RabbitMQ channel into its corresponding connection worker
checkout_channel(conn_worker)
View Source
checkout_channel(pid()) ::
{:ok, AMQP.Channel.t()} | {:error, :disconnected | :out_of_channels}
checkout_channel(pid()) :: {:ok, AMQP.Channel.t()} | {:error, :disconnected | :out_of_channels}
Gets a RabbitMQ channel out of a connection worker
create_queue_with_bind(adapter, pool_id, queue, exchange, options \\ [])
View Source
create_queue_with_bind(
module(),
atom(),
AMQP.Basic.queue(),
AMQP.Basic.exchange(),
keyword()
) :: :ok | AMQP.Basic.error() | {:error, any()}
create_queue_with_bind( module(), atom(), AMQP.Basic.queue(), AMQP.Basic.exchange(), keyword() ) :: :ok | AMQP.Basic.error() | {:error, any()}
get_connection(pool_id)
View Source
get_connection(atom()) :: {:ok, AMQP.Connection.t()} | {:error, :disconnected}
get_connection(atom()) :: {:ok, AMQP.Connection.t()} | {:error, :disconnected}
Gets a connection from a connection worker so any client can exec commands manually
get_connection_worker(pool_id) View Source
Retrieve a connection worker - we don't care about isolating access to each worker - we use a pool purely in order to spread load (pool config strategy :fifo)
with_channel(pool_id, fun) View Source
Executes function f in the context of a channel, takes a connection worker out of the pool, put that connection worker back into the pool so any other concurrent client can have access to it, checks out a channel out of the worker's channel pool, executes the function with the result of the checkout and finally puts the channel back into the worker's pool.