AMQPX v1.0.0 AMQPX.Receiver View Source

Provides message handling with transparent connection recovery.

Starts a supervisor with a connection watchdog and a handler process. In case of connection loss the process group will be shutdown and restarted until it can reconnect.

The message handler is responsible for setting up all its AMQP entities. AMQPX.Receiver.Standard should be used for simple cases as it provides some sane default behaviours and takes care of some common pitfalls. If you’re implementing your own receiver, read the documentation of AMQPX.Receiver.Standard to be aware of them.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor

Starts the process group

Link to this section Types

Link to this type option() View Source
option() ::
  {:connection, name :: atom()}
  | {:worker,
     module() | (args :: Keyword.t()) | {module(), args :: Keyword.t()}}
  | {:reconnect, seconds :: integer()}
  | {:max_restarts, integer()}
  | {:max_seconds, integer()}

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function start_link(args) View Source
start_link([option()]) :: {:ok, pid()}

Starts the process group.

Options

  • :connection – the connection name as registered with AMQPX.ConnectionPool
  • :worker – the handler module; see below
  • :reconnect – the interval between recovery attempts in case of connection loss

max_restarts and max_seconds are used to set the supervisor’s crash tolerance if both are set. Otherwise it is inferred from :reconnect to be able to keep retrying undefinitely until the broker comes back up.

Worker settings

If the worker module is not set, AMQPX.Receiver.Standard is used.

Custom worker modules must export start_link/1, which will receive args. The :connection option will be added to args automatically.