spotter v0.3.1 Spotter.AMQP.Connection.Helper
Helper functions to manage connections with AMQP.
This module produces verbose debug logs.
Link to this section Summary
Functions
Bind AMQP queue to Exchange
Gracefully close AMQP channel
Declare AMQP exchange. Exchange is durable whenever queue is durable
Declare AMQP queue. You can omit error_queue
, then dead letter queue won’t be created.
Dead letter queue is hardcoded to be durable
Same as open_channel!/1
, but returns {:ok, connection} or {:error, reason} tuples
Open new AMQP channel inside a connection
Same as open_connection!/1
, but returns {:ok, connection} or {:error, reason} tuples
Open AMQP connection
Set channel QOS policy. Especially useful when you want to limit number of unacknowledged request per worker
Link to this section Functions
Bind AMQP queue to Exchange.
See: https://hexdocs.pm/amqp/AMQP.Queue.html#bind/4
Gracefully close AMQP channel.
Declare AMQP exchange. Exchange is durable whenever queue is durable.
Types:
:direct
- direct exchange.:fanout
- fanout exchange.:topic
- topic exchange.:headers
- headers exchange.
See: https://hexdocs.pm/amqp/AMQP.Queue.html#declare/3
Declare AMQP queue. You can omit error_queue
, then dead letter queue won’t be created.
Dead letter queue is hardcoded to be durable.
Options
:durable
- If set, keeps the Queue between restarts of the broker:auto-delete
- If set, deletes the Queue once all subscribers disconnect:exclusive
- If set, only one subscriber can consume from the Queue:passive
- If set, raises an error unless the queue already exists
See: https://hexdocs.pm/amqp/AMQP.Queue.html#declare/3
Same as open_channel!/1
, but returns {:ok, connection} or {:error, reason} tuples.
Open new AMQP channel inside a connection.
See: https://hexdocs.pm/amqp/AMQP.Channel.html#open/1
Same as open_connection!/1
, but returns {:ok, connection} or {:error, reason} tuples.
Open AMQP connection.
Options
:username
- The name of a user registered with the broker (defaults to “guest”);:password
- The password of user (defaults to “guest”);:virtual_host
- The name of a virtual host in the broker (defaults to “/“);:host
- The hostname of the broker (defaults to “localhost”);:port
- The port the broker is listening on (defaults to5672
);:channel_max
- The channel_max handshake parameter (defaults to0
);:frame_max
- The frame_max handshake parameter (defaults to0
);:heartbeat
- The hearbeat interval in seconds (defaults to0
- turned off);:connection_timeout
- The connection timeout in milliseconds (defaults to15_000
);:ssl_options
- Enable SSL by setting the location to cert files (defaults tonone
);:client_properties
- A list of extra client properties to be sent to the server, defaults to[]
;:socket_options
- Extra socket options. These are appended to the default options. See http://www.erlang.org/doc/man/inet.html#setopts-2 and http://www.erlang.org/doc/man/gen_tcp.html#connect-4 for descriptions of the available options.
See: https://hexdocs.pm/amqp/AMQP.Connection.html#open/1
Set channel QOS policy. Especially useful when you want to limit number of unacknowledged request per worker.
Options
:prefetch_size
- Limit of unacknowledged messages (in bytes).:prefetch_count
- Limit of unacknowledged messages (count).:global
- Ifglobal
is set totrue
this applies to the entire Connection, otherwise it applies only to the specified Channel.
See: https://hexdocs.pm/amqp/AMQP.Basic.html#qos/2