lapin v0.1.5 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
Connection
Functions
Closes the connection
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
Channel configuration
The following keys are supported:
role: channel role (
atom), allowed values are::consumer: Receives messages from the channel via theworkermodule:producer: Can publish messages to che channel:passive: Used to declare channel configuration, can’t receive nor publish
- worker: channel worker (module conforming to the
Lapin.Workerbehaviour) - exchange: broker exchange (
String.t) - queue: broker queue (
String.t)
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: “”
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: []
Exchange name
Module conforming to Lapin.Pattern
Queue name
Channel role
Routing key
Connection
Link to this section Functions
Closes the connection
publish(connection :: t(), exchange(), routing_key(), message :: Lapin.Message.t(), options :: Keyword.t()) :: Lapin.Worker.on_callback()
Publishes a message to the specified exchange with the given routing_key
start_link(config(), options :: GenServer.options()) :: GenServer.on_start()
Starts a Lapin.Connection with the specified configuration