channels v0.0.1 Channels.Context.Spec
This modules parses context specification.
A context specification defines how exchanges, queues or any broker related resources must be declared or configured before an AMQP process interacts with them.
Example
Imagine you defined a connection named :my_connection on your Mix config:
config :channels,
...
connections: [:my_connection]
config :channels, :my_connection,
host: "localhost",
port: 1234
...
This is an example of possible configuration for a consumer that subscribes to a queue “my_queue” to the direct exchange “my_exchange” only for the routing_key “the_key” through the previously defined connection:
[
connection: :my_connection,
exchange: [
name: "my_exchange",
type: :direct,
opts: [durable: true]
],
queue: [
name: "my_queue",
opts: [durable: true, exclusive: true]
],
bind: [routing_key: "the_key"]
]
Summary
Functions
Returns the binding configuration. It is optional. By default it is an empty keyword list
Returns a new Spec struct given a configuration
Returns the exchange configuration. It expects at least the following fields
Returns a new Spec struct given a configuration
Returns the queue configuration. It expects at least the name field
Types
Functions
Returns the binding configuration. It is optional. By default it is an empty keyword list.
bind: [routing_key: "my_key", ...]
It can include a set of option to be given to the adapter when binding the queue and the exchange.
Specs
conn_name(t) ::
{:ok, name :: atom} |
{:error, reason :: term}
Returns a new Spec struct given a configuration
Returns the exchange configuration. It expects at least the following fields:
exchange: [name: "exchange_name", type: :direct]
Also it can include an :opts field which is a keyword list of options to be given to the adapter when declaring the exchange.
Returns the queue configuration. It expects at least the name field:
queue: [name: "queue_name"]
Also it can include an :opts field which is a keyword list of options to be given to the adapter when declaring the queue.