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

Contains helper and util functions for the entire WhiteRabbit library.

Link to this section Summary

Functions

Get backoff delay from linked agent.

Get the application's default channel. If not available, open another.

Get a random channel from the pool to use.

Setup an exchange with some default args.

Setup of queues for the Consumer. Binds them to exhanges with all the routing_keys Uses :exchange, :queue, :error_queue from Genserver args for declaration.

Link to this section Functions

Link to this function

declare_queue(channel, queue, error_queue, exchange, queue_opts, binding_key)

View Source
@spec declare_queue(
  AMQP.Channel.t(),
  String.t(),
  String.t(),
  AMQP.Exchange.t(),
  Keyword.t(),
  String.t()
) :: :ok

Declare a queue with a dead-letter queue

@spec get_backoff(Agent.agent()) :: non_neg_integer()

Get backoff delay from linked agent.

Link to this function

get_channel(channel_name, connection_name)

View Source
@spec get_channel(atom(), atom()) :: {:ok, AMQP.Channel.t()}

Get the application's default channel. If not available, open another.

You can monitor the returned channel for :DOWN events to be able to re-register as a consumer.

Link to this function

get_channel_from_pool(connection_name, registry)

View Source
@spec get_channel_from_pool(connection_name :: atom(), registry :: atom()) ::
  {:ok, AMQP.Channel.t()} | {:error, any()}

Get a random channel from the pool to use.

Returns {:ok, AMQP.Channel.t()}

Link to this function

setup_exchange(channel, exchange, exchange_type)

View Source
@spec setup_exchange(AMQP.Channel.t(), AMQP.Exchange.t(), atom()) :: :ok

Setup an exchange with some default args.

Link to this function

setup_queues(channel, opts)

View Source

Setup of queues for the Consumer. Binds them to exhanges with all the routing_keys Uses :exchange, :queue, :error_queue from Genserver args for declaration.

Link to this function

test_publish(number \\ 100, exchange \\ "json_test_exchange", routing_key \\ "test_json", payload \\ %{hello: "world"}, options \\ [])

View Source
@spec test_publish(integer(), String.t(), String.t(), map(), Keyword.t()) :: [atom()]
Link to this function

uuid_tag(bytes_count \\ 8)

View Source
@spec uuid_tag(integer()) :: binary()