lapin v0.1.1 Lapin.Connection

RabbitMQ connection handler

Link to this section Summary

Types

Channel configuration

Connection configuration

Exchange name

Module conforming to Lapin.Pattern

Queue name

Channel role

Routing key

Functions

Publishes a message to the specified exchange with the given routing_key

Starts a Lapin.Connection with the specified configuration

Link to this section Types

Link to this type channel_config()
channel_config() :: Keyword.t

Channel configuration

The following keys are supported:

  • role: channel role (:consumer | :producer)
  • worker: channel worker (module impelmenting the Lapin.Worker behaviour)
  • exchange: broker exchange (string)
  • queue: broker queue (string)

If using the default Lapin.Pattern implementation, the following keys are also supported:

  • consumer_ack: send consumer ack (boolean), default: false
  • consumer_prefetch cosumer prefetch (integer | nil), default: nil
  • exchange_type: declare type of the exchange (:direct, :fanout, :topic), default: :direct
  • exchange_durable: declare exchange as durable (boolean), default: true
  • publisher_confirm: expect RabbitMQ publish confirms (boolean), default: false
  • publisher_mandatory: messages published as mandatory by default (boolean), deafault: false
  • publisher_persistent: messages published as persistent by default (boolean), deafault: false
  • queue_arguments: queue arguments (list of {string, type, value}), default: []
  • queue_durable: declare queue as durable (boolean), default: true
  • routing_key: routing_key for bindings (string), default: “”
Link to this type config()
config() :: [{:channels, [channel_config]}]

Connection configuration

The following keys are supported:

  • host: broker hostname (string | charlist), default: ‘localhost’
  • port: broker port (string | integer), default: 5672
  • virtual_host: broker vhost (string), default: “”
  • username: username (string)
  • password: password (string)
  • auth_mechanisms: broker auth_mechanisms ([:amqplain | :external | :plain]), default: amqp_client default
  • ssl_options: ssl options ([:ssl:ssl_option]), default: none
  • channels: channels to configure ([channel_config]), default: []
Link to this type exchange()
exchange() :: String.t

Exchange name

Link to this type pattern()
pattern() :: Lapin.Pattern

Module conforming to Lapin.Pattern

Link to this type queue()
queue() :: String.t

Queue name

Link to this type role()
role() :: :consumer | :producer

Channel role

Link to this type routing_key()
routing_key() :: String.t

Routing key

Link to this section Functions

Link to this function publish(server, exchange, routing_key, message, options \\ [])

Publishes a message to the specified exchange with the given routing_key

Link to this function start_link(configuration, options \\ [])
start_link(config, options :: GenServer.options) :: GenServer.on_start

Starts a Lapin.Connection with the specified configuration