Flux AMQP
Interface to connect to AMQP broker, sending and retrieving messages.
It uses AMQP, check their documentation to understand
how this library perform the connection, configuration, consumption and delivery of
AMQP messages.
Usage
Add Flux AMQP as a dependency in your
mix.exs file:
def deps do
[{:flux_amqp, "~> 0.0.3"}]
end
FluxAMQP describes how to define and close a connection and how to send a message.
FluxAMQP.Consumer describes how to consume AMQP messages.
Application Configuration
import Config
# Default values
config :flux_amqp,
broker: [
uri: "amqp://guest:guest@rabbitmq",
connection: [
reattempt_connection_on_failure?: true,
reattempt: [
maximum_attempts: :infinity,
waiting_ms: 10_000
]
]
],
routing_keys: []
Configuration Options
:broker- Set the AMQP broker. Acceptskeyword/0. Options are::uri- The AMQP Broker URI. Defaults toamqp://guest:guest@rabbitmq. AcceptsString.t/0.:connection- Set the AMQP broker connection. Acceptskeyword/0. Options are::reattempt_connection_on_failure?- Iftrue, when a connection to AMQP broker fails, a reattempt will be performed. Defaults totrue. Acceptsboolean/0.:reattempt- Set the reattempt settings. Acceptskeyword/0. Options are::maximum_attempts- How many attempts should be performed in case of connection failure. If set to:infinity, it will try until connection succeeds. Defaults to:infinity. Acceptsinteger/0or:infinity.:waiting_ms- How many milliseconds should wait before reattempting connection. Defaults to10_000. Acceptsinteger/0.
:routing_keys- The AMQP routing keys which the messages will be consumed. A routing key can be defined as a tuple{routing_key, exchange}or as therouting_key(the exchange will be set toamq.topic). Defaults to an empty list. AcceptsString.t/0ortuple/0. CheckAMQP.Exchange.declare/4for more information about exchange definition.