hare v0.2.2 Hare.Core.Exchange
This module defines the Hare.Core.Exchange
struct that represents
an exchange and holds a channel to interact with it.
Summary
Functions
Declares an exchange on the AMQP server through the given channel, and builds an exchange struct associated to that channel
Builds the default exchange associated to the given channel
It deletes the given exchange
Builds an exchange with the given name associated to the given channel
Publishes a message to the given exchange
Types
Functions
Declares an exchange on the AMQP server through the given channel, and builds an exchange struct associated to that channel.
It expects the common exchange attributes that will be given to the underlying adapter:
name
- The name of the exchange to declaretype
- The type of the exchange as an atom (:fanout, :direct, etc)opts
- The exchange options
It deletes the given exchange.
It expects:
exchange
- The exchange (and its associated channel) to deleteopts
- The delete options that will be delegated directly to the adapter
Builds an exchange with the given name associated to the given channel.
The exchange is supposed to already be declared on the server in order
to use it to run functions like publish/4
.
Is recommended to always use declare/4
instead of new/2
in order to
ensure the exchange is already declared as expected before using it.
publish(t, payload, routing_key, opts) :: :ok
Publishes a message to the given exchange.
It expects the following arguments:
exchange
- The exchange (and its associated channel) to publish the message topayload
- The content of the message to be publishedrouting_key
- The routing keyopts
- The publish options that will be delegated directly to the adapter