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

Link to this type

f() View Source
f() ::
  ({:ok, AMQP.Channel.t()} | {:error, :disconnected | :out_of_channels} ->
     any())

Link to this section Functions

Link to this function

checkin_channel(conn_worker, channel) View Source
checkin_channel(pid(), AMQP.Channel.t()) :: :ok

Puts back a RabbitMQ channel into its corresponding connection worker

Link to this function

checkout_channel(conn_worker) View Source
checkout_channel(pid()) ::
  {:ok, AMQP.Channel.t()} | {:error, :disconnected | :out_of_channels}

Gets a RabbitMQ channel out of a connection worker

Link to this function

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()}

Link to this function

get_connection(pool_id) View Source
get_connection(atom()) :: {:ok, AMQP.Connection.t()} | {:error, :disconnected}

Gets a connection from a connection worker so any client can exec commands manually

Link to this function

get_connection_worker(pool_id) View Source
get_connection_worker(atom()) :: pid()

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)

Link to this function

with_channel(pool_id, fun) View Source
with_channel(atom(), f()) :: any()

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.