Yggdrasil.Config.RabbitMQ (Yggdrasil for RabbitMQ v6.0.0) View Source

This module defines the available config variables for RabbitMQ in Yggdrasil.

Link to this section Summary

Functions

RabbitMQ heartbeat. Defaults to 10 seconds.

RabbitMQ heartbeat. Defaults to 10 seconds.

RabbitMQ hostname. Defaults to "localhost".

RabbitMQ hostname. Defaults to "localhost".

RabbitMQ max retries for the backoff algorithm. Defaults to 3.

RabbitMQ max retries for the backoff algorithm. Defaults to 3.

RabbitMQ password. Defaults to "guest".

RabbitMQ password. Defaults to "guest".

RabbitMQ port. Defaults to 5672.

RabbitMQ port. Defaults to 5672.

Preloads all variables in a namespace if supplied.

RabbitMQ amount of publisher connections.

RabbitMQ amount of publisher connections.

Puts the value to Yggdrasil.Config.RabbitMQ.heartbeat/0. Optionally, receives the namespace.

Puts the value to Yggdrasil.Config.RabbitMQ.hostname/0. Optionally, receives the namespace.

Puts the value to Yggdrasil.Config.RabbitMQ.max_retries/0. Optionally, receives the namespace.

Puts the value to Yggdrasil.Config.RabbitMQ.password/0. Optionally, receives the namespace.

Puts the value to Yggdrasil.Config.RabbitMQ.port/0. Optionally, receives the namespace.

Puts the value to Yggdrasil.Config.RabbitMQ.slot_size/0. Optionally, receives the namespace.

Puts the value to Yggdrasil.Config.RabbitMQ.username/0. Optionally, receives the namespace.

Puts the value to Yggdrasil.Config.RabbitMQ.virtual_host/0. Optionally, receives the namespace.

Reloads the value for Yggdrasil.Config.RabbitMQ.heartbeat/0. Optionally, receives the namespace for the variable.

Reloads the value for Yggdrasil.Config.RabbitMQ.hostname/0. Optionally, receives the namespace for the variable.

Reloads the value for Yggdrasil.Config.RabbitMQ.max_retries/0. Optionally, receives the namespace for the variable.

Reloads the value for Yggdrasil.Config.RabbitMQ.password/0. Optionally, receives the namespace for the variable.

Reloads the value for Yggdrasil.Config.RabbitMQ.port/0. Optionally, receives the namespace for the variable.

Reloads the value for Yggdrasil.Config.RabbitMQ.publisher_connections/0. Optionally, receives the namespace for the variable.

Reloads the value for Yggdrasil.Config.RabbitMQ.slot_size/0. Optionally, receives the namespace for the variable.

Reloads the value for Yggdrasil.Config.RabbitMQ.subscriber_connections/0. Optionally, receives the namespace for the variable.

Reloads the value for Yggdrasil.Config.RabbitMQ.username/0. Optionally, receives the namespace for the variable.

Reloads the value for Yggdrasil.Config.RabbitMQ.virtual_host/0. Optionally, receives the namespace for the variable.

RabbitMQ slot size for the backoff algorithm. Defaults to 10.

RabbitMQ slot size for the backoff algorithm. Defaults to 10.

RabbitMQ amount of subscriber connections.

RabbitMQ amount of subscriber connections.

Creates a template for OS environment variables given a filename. Additionally, it can receive a list of options

RabbitMQ username. Defaults to "guest".

RabbitMQ username. Defaults to "guest".

Validates that all required variables are present. Returns :ok if they are, {:error, errors} if they are not. errors will be a list of all errors encountered while getting required variables.

Validates that all required variables are present. Returns :ok if they are, raises if they're not.

RabbitMQ virtual host. Defaults to "/".

RabbitMQ virtual host. Defaults to "/".

Link to this section Functions

Link to this function

heartbeat(namespace \\ nil)

View Source

Specs

heartbeat(Skogsra.Env.namespace()) :: {:ok, integer()} | {:error, binary()}

RabbitMQ heartbeat. Defaults to 10 seconds.

iex> Yggdrasil.Config.RabbitMQ.heartbeat()
{:ok, 10}

Calling Yggdrasil.Config.RabbitMQ.heartbeat() will ensure the following:

  • Binding order: [:system, :config]
  • OS environment variable: "YGGDRASIL_RABBITMQ_HEARTBEAT"
  • Type: :integer
  • Default: 10
  • Required: false
  • Cached: true
Link to this function

heartbeat!(namespace \\ nil)

View Source

Specs

heartbeat!(Skogsra.Env.namespace()) :: integer() | no_return()

RabbitMQ heartbeat. Defaults to 10 seconds.

iex> Yggdrasil.Config.RabbitMQ.heartbeat()
{:ok, 10}

Bang version of Yggdrasil.Config.RabbitMQ.heartbeat/0 (fails on error). Optionally, receives the namespace for the variable.

Link to this function

hostname(namespace \\ nil)

View Source

Specs

hostname(Skogsra.Env.namespace()) :: {:ok, binary()} | {:error, binary()}

RabbitMQ hostname. Defaults to "localhost".

Calling Yggdrasil.Config.RabbitMQ.hostname() will ensure the following:

  • Binding order: [:system, :config]
  • OS environment variable: "YGGDRASIL_RABBITMQ_HOSTNAME"
  • Type: :binary
  • Default: "localhost"
  • Required: false
  • Cached: true
Link to this function

hostname!(namespace \\ nil)

View Source

Specs

hostname!(Skogsra.Env.namespace()) :: binary() | no_return()

RabbitMQ hostname. Defaults to "localhost".

Bang version of Yggdrasil.Config.RabbitMQ.hostname/0 (fails on error). Optionally, receives the namespace for the variable.

Link to this function

max_retries(namespace \\ nil)

View Source

Specs

max_retries(Skogsra.Env.namespace()) :: {:ok, integer()} | {:error, binary()}

RabbitMQ max retries for the backoff algorithm. Defaults to 3.

The backoff algorithm is exponential:

backoff_time = pow(2, retries) * random(1, slot) * 1_000 ms

when retries <= MAX_RETRIES and slot is given by the configuration variable Elixir.Yggdrasil.Config.RabbitMQ.slot_size/0 (defaults to 10 secs).

iex> Yggdrasil.Config.RabbitMQ.max_retries()
{:ok, 3}

Calling Yggdrasil.Config.RabbitMQ.max_retries() will ensure the following:

  • Binding order: [:system, :config]
  • OS environment variable: "YGGDRASIL_RABBITMQ_MAX_RETRIES"
  • Type: :integer
  • Default: 3
  • Required: false
  • Cached: true
Link to this function

max_retries!(namespace \\ nil)

View Source

Specs

max_retries!(Skogsra.Env.namespace()) :: integer() | no_return()

RabbitMQ max retries for the backoff algorithm. Defaults to 3.

The backoff algorithm is exponential:

backoff_time = pow(2, retries) * random(1, slot) * 1_000 ms

when retries <= MAX_RETRIES and slot is given by the configuration variable Elixir.Yggdrasil.Config.RabbitMQ.slot_size/0 (defaults to 10 secs).

iex> Yggdrasil.Config.RabbitMQ.max_retries()
{:ok, 3}

Bang version of Yggdrasil.Config.RabbitMQ.max_retries/0 (fails on error). Optionally, receives the namespace for the variable.

Link to this function

password(namespace \\ nil)

View Source

Specs

password(Skogsra.Env.namespace()) :: {:ok, binary()} | {:error, binary()}

RabbitMQ password. Defaults to "guest".

iex> Yggdrasil.Config.RabbitMQ.password()
{:ok, "guest"}

Calling Yggdrasil.Config.RabbitMQ.password() will ensure the following:

  • Binding order: [:system, :config]
  • OS environment variable: "YGGDRASIL_RABBITMQ_PASSWORD"
  • Type: :binary
  • Default: "guest"
  • Required: false
  • Cached: true
Link to this function

password!(namespace \\ nil)

View Source

Specs

password!(Skogsra.Env.namespace()) :: binary() | no_return()

RabbitMQ password. Defaults to "guest".

iex> Yggdrasil.Config.RabbitMQ.password()
{:ok, "guest"}

Bang version of Yggdrasil.Config.RabbitMQ.password/0 (fails on error). Optionally, receives the namespace for the variable.

Specs

port(Skogsra.Env.namespace()) :: {:ok, integer()} | {:error, binary()}

RabbitMQ port. Defaults to 5672.

Calling Yggdrasil.Config.RabbitMQ.port() will ensure the following:

  • Binding order: [:system, :config]
  • OS environment variable: "YGGDRASIL_RABBITMQ_PORT"
  • Type: :integer
  • Default: 5672
  • Required: false
  • Cached: true

Specs

RabbitMQ port. Defaults to 5672.

Bang version of Yggdrasil.Config.RabbitMQ.port/0 (fails on error). Optionally, receives the namespace for the variable.

Link to this function

preload(namespace \\ nil)

View Source

Specs

preload(Skogsra.Env.namespace()) :: :ok

Preloads all variables in a namespace if supplied.

Link to this function

publisher_connections(namespace \\ nil)

View Source

Specs

publisher_connections(Skogsra.Env.namespace()) ::
  {:ok, integer()} | {:error, binary()}

RabbitMQ amount of publisher connections.

iex> Yggdrasil.Config.RabbitMQ.publisher_connections()
{:ok, 1}

Calling Yggdrasil.Config.RabbitMQ.publisher_connections() will ensure the following:

  • Binding order: [:system, :config]
  • OS environment variable: "YGGDRASIL_RABBITMQ_PUBLISHER_CONNECTIONS"
  • Type: :integer
  • Default: 1
  • Required: false
  • Cached: true
Link to this function

publisher_connections!(namespace \\ nil)

View Source

Specs

publisher_connections!(Skogsra.Env.namespace()) :: integer() | no_return()

RabbitMQ amount of publisher connections.

iex> Yggdrasil.Config.RabbitMQ.publisher_connections()
{:ok, 1}

Bang version of Yggdrasil.Config.RabbitMQ.publisher_connections/0 (fails on error). Optionally, receives the namespace for the variable.

Link to this function

put_heartbeat(value, namespace \\ nil)

View Source

Specs

put_heartbeat(integer(), Skogsra.Env.namespace()) :: :ok | {:error, binary()}

Puts the value to Yggdrasil.Config.RabbitMQ.heartbeat/0. Optionally, receives the namespace.

Link to this function

put_hostname(value, namespace \\ nil)

View Source

Specs

put_hostname(binary(), Skogsra.Env.namespace()) :: :ok | {:error, binary()}

Puts the value to Yggdrasil.Config.RabbitMQ.hostname/0. Optionally, receives the namespace.

Link to this function

put_max_retries(value, namespace \\ nil)

View Source

Specs

put_max_retries(integer(), Skogsra.Env.namespace()) :: :ok | {:error, binary()}

Puts the value to Yggdrasil.Config.RabbitMQ.max_retries/0. Optionally, receives the namespace.

Link to this function

put_password(value, namespace \\ nil)

View Source

Specs

put_password(binary(), Skogsra.Env.namespace()) :: :ok | {:error, binary()}

Puts the value to Yggdrasil.Config.RabbitMQ.password/0. Optionally, receives the namespace.

Link to this function

put_port(value, namespace \\ nil)

View Source

Specs

put_port(integer(), Skogsra.Env.namespace()) :: :ok | {:error, binary()}

Puts the value to Yggdrasil.Config.RabbitMQ.port/0. Optionally, receives the namespace.

Link to this function

put_publisher_connections(value, namespace \\ nil)

View Source

Specs

put_publisher_connections(integer(), Skogsra.Env.namespace()) ::
  :ok | {:error, binary()}

Puts the value to Yggdrasil.Config.RabbitMQ.publisher_connections/0. Optionally, receives the namespace.

Link to this function

put_slot_size(value, namespace \\ nil)

View Source

Specs

put_slot_size(integer(), Skogsra.Env.namespace()) :: :ok | {:error, binary()}

Puts the value to Yggdrasil.Config.RabbitMQ.slot_size/0. Optionally, receives the namespace.

Link to this function

put_subscriber_connections(value, namespace \\ nil)

View Source

Specs

put_subscriber_connections(integer(), Skogsra.Env.namespace()) ::
  :ok | {:error, binary()}

Puts the value to Yggdrasil.Config.RabbitMQ.subscriber_connections/0. Optionally, receives the namespace.

Link to this function

put_username(value, namespace \\ nil)

View Source

Specs

put_username(binary(), Skogsra.Env.namespace()) :: :ok | {:error, binary()}

Puts the value to Yggdrasil.Config.RabbitMQ.username/0. Optionally, receives the namespace.

Link to this function

put_virtual_host(value, namespace \\ nil)

View Source

Specs

put_virtual_host(binary(), Skogsra.Env.namespace()) :: :ok | {:error, binary()}

Puts the value to Yggdrasil.Config.RabbitMQ.virtual_host/0. Optionally, receives the namespace.

Link to this function

reload_heartbeat(namespace \\ nil)

View Source

Specs

reload_heartbeat(Skogsra.Env.namespace()) ::
  {:ok, integer()} | {:error, binary()}

Reloads the value for Yggdrasil.Config.RabbitMQ.heartbeat/0. Optionally, receives the namespace for the variable.

Link to this function

reload_hostname(namespace \\ nil)

View Source

Specs

reload_hostname(Skogsra.Env.namespace()) :: {:ok, binary()} | {:error, binary()}

Reloads the value for Yggdrasil.Config.RabbitMQ.hostname/0. Optionally, receives the namespace for the variable.

Link to this function

reload_max_retries(namespace \\ nil)

View Source

Specs

reload_max_retries(Skogsra.Env.namespace()) ::
  {:ok, integer()} | {:error, binary()}

Reloads the value for Yggdrasil.Config.RabbitMQ.max_retries/0. Optionally, receives the namespace for the variable.

Link to this function

reload_password(namespace \\ nil)

View Source

Specs

reload_password(Skogsra.Env.namespace()) :: {:ok, binary()} | {:error, binary()}

Reloads the value for Yggdrasil.Config.RabbitMQ.password/0. Optionally, receives the namespace for the variable.

Link to this function

reload_port(namespace \\ nil)

View Source

Specs

reload_port(Skogsra.Env.namespace()) :: {:ok, integer()} | {:error, binary()}

Reloads the value for Yggdrasil.Config.RabbitMQ.port/0. Optionally, receives the namespace for the variable.

Link to this function

reload_publisher_connections(namespace \\ nil)

View Source

Specs

reload_publisher_connections(Skogsra.Env.namespace()) ::
  {:ok, integer()} | {:error, binary()}

Reloads the value for Yggdrasil.Config.RabbitMQ.publisher_connections/0. Optionally, receives the namespace for the variable.

Link to this function

reload_slot_size(namespace \\ nil)

View Source

Specs

reload_slot_size(Skogsra.Env.namespace()) ::
  {:ok, integer()} | {:error, binary()}

Reloads the value for Yggdrasil.Config.RabbitMQ.slot_size/0. Optionally, receives the namespace for the variable.

Link to this function

reload_subscriber_connections(namespace \\ nil)

View Source

Specs

reload_subscriber_connections(Skogsra.Env.namespace()) ::
  {:ok, integer()} | {:error, binary()}

Reloads the value for Yggdrasil.Config.RabbitMQ.subscriber_connections/0. Optionally, receives the namespace for the variable.

Link to this function

reload_username(namespace \\ nil)

View Source

Specs

reload_username(Skogsra.Env.namespace()) :: {:ok, binary()} | {:error, binary()}

Reloads the value for Yggdrasil.Config.RabbitMQ.username/0. Optionally, receives the namespace for the variable.

Link to this function

reload_virtual_host(namespace \\ nil)

View Source

Specs

reload_virtual_host(Skogsra.Env.namespace()) ::
  {:ok, binary()} | {:error, binary()}

Reloads the value for Yggdrasil.Config.RabbitMQ.virtual_host/0. Optionally, receives the namespace for the variable.

Link to this function

slot_size(namespace \\ nil)

View Source

Specs

slot_size(Skogsra.Env.namespace()) :: {:ok, integer()} | {:error, binary()}

RabbitMQ slot size for the backoff algorithm. Defaults to 10.

iex> Yggdrasil.Config.RabbitMQ.slot_size()
{:ok, 10}

Calling Yggdrasil.Config.RabbitMQ.slot_size() will ensure the following:

  • Binding order: [:system, :config]
  • OS environment variable: "YGGDRASIL_RABBITMQ_SLOT_SIZE"
  • Type: :integer
  • Default: 10
  • Required: false
  • Cached: true
Link to this function

slot_size!(namespace \\ nil)

View Source

Specs

slot_size!(Skogsra.Env.namespace()) :: integer() | no_return()

RabbitMQ slot size for the backoff algorithm. Defaults to 10.

iex> Yggdrasil.Config.RabbitMQ.slot_size()
{:ok, 10}

Bang version of Yggdrasil.Config.RabbitMQ.slot_size/0 (fails on error). Optionally, receives the namespace for the variable.

Link to this function

subscriber_connections(namespace \\ nil)

View Source

Specs

subscriber_connections(Skogsra.Env.namespace()) ::
  {:ok, integer()} | {:error, binary()}

RabbitMQ amount of subscriber connections.

iex> Yggdrasil.Config.RabbitMQ.subscriber_connections()
{:ok, 1}

Calling Yggdrasil.Config.RabbitMQ.subscriber_connections() will ensure the following:

  • Binding order: [:system, :config]
  • OS environment variable: "YGGDRASIL_RABBITMQ_SUBSCRIBER_CONNECTIONS"
  • Type: :integer
  • Default: 1
  • Required: false
  • Cached: true
Link to this function

subscriber_connections!(namespace \\ nil)

View Source

Specs

subscriber_connections!(Skogsra.Env.namespace()) :: integer() | no_return()

RabbitMQ amount of subscriber connections.

iex> Yggdrasil.Config.RabbitMQ.subscriber_connections()
{:ok, 1}

Bang version of Yggdrasil.Config.RabbitMQ.subscriber_connections/0 (fails on error). Optionally, receives the namespace for the variable.

Link to this function

template(filename, options \\ [])

View Source

Specs

template(Path.t(), keyword()) :: :ok | {:error, File.posix()}

Creates a template for OS environment variables given a filename. Additionally, it can receive a list of options:

  • type: What kind of file it will generate (:elixir, :unix, :windows).
  • namespace: Namespace for the variables.
Link to this function

username(namespace \\ nil)

View Source

Specs

username(Skogsra.Env.namespace()) :: {:ok, binary()} | {:error, binary()}

RabbitMQ username. Defaults to "guest".

iex> Yggdrasil.Config.RabbitMQ.username()
{:ok, "guest"}

Calling Yggdrasil.Config.RabbitMQ.username() will ensure the following:

  • Binding order: [:system, :config]
  • OS environment variable: "YGGDRASIL_RABBITMQ_USERNAME"
  • Type: :binary
  • Default: "guest"
  • Required: false
  • Cached: true
Link to this function

username!(namespace \\ nil)

View Source

Specs

username!(Skogsra.Env.namespace()) :: binary() | no_return()

RabbitMQ username. Defaults to "guest".

iex> Yggdrasil.Config.RabbitMQ.username()
{:ok, "guest"}

Bang version of Yggdrasil.Config.RabbitMQ.username/0 (fails on error). Optionally, receives the namespace for the variable.

Link to this function

validate(namespace \\ nil)

View Source

Specs

validate(Skogsra.Env.namespace()) :: :ok | {:error, [binary()]}

Validates that all required variables are present. Returns :ok if they are, {:error, errors} if they are not. errors will be a list of all errors encountered while getting required variables.

It is possible to provide a namespace as argument (defaults to nil).

Link to this function

validate!(namespace \\ nil)

View Source

Specs

validate!(Skogsra.Env.namespace()) :: :ok | no_return()

Validates that all required variables are present. Returns :ok if they are, raises if they're not.

It is possible to provide a namespace as argument (defaults to nil).

Link to this function

virtual_host(namespace \\ nil)

View Source

Specs

virtual_host(Skogsra.Env.namespace()) :: {:ok, binary()} | {:error, binary()}

RabbitMQ virtual host. Defaults to "/".

iex> Yggdrasil.Config.RabbitMQ.virtual_host()
{:ok, "/"}

Calling Yggdrasil.Config.RabbitMQ.virtual_host() will ensure the following:

  • Binding order: [:system, :config]
  • OS environment variable: "YGGDRASIL_RABBITMQ_VIRTUAL_HOST"
  • Type: :binary
  • Default: "/"
  • Required: false
  • Cached: true
Link to this function

virtual_host!(namespace \\ nil)

View Source

Specs

virtual_host!(Skogsra.Env.namespace()) :: binary() | no_return()

RabbitMQ virtual host. Defaults to "/".

iex> Yggdrasil.Config.RabbitMQ.virtual_host()
{:ok, "/"}

Bang version of Yggdrasil.Config.RabbitMQ.virtual_host/0 (fails on error). Optionally, receives the namespace for the variable.