hare v0.1.9 Hare.Context.Action.DeclareExchange
This module implements a Hare.Context.Action behaviour to
declare an exchange on the AMQP server.
Config
Configuration must be a Keyword.t with the following fields:
:name- the name of the exchange:type- (defaults to:direct) the type of the exchange:opts- (defaults to[]) the options to be given to the adapter:export_as- (defaults tonil) the key to export the declared exchange to
The :export_as config allows the action to export a Hare.Core.Exchange
struct to be used later by other steps (for example: to bind a queue to it)
alias Hare.Context.Action.DeclareExchange
config = [name: "foo",
type: :fanout,
opts: [durable: true],
export_as: :ex]
exports = %{}
DeclareExchange.run(chan, config, exports)
# => {:ok, nil, %{ex: %Hare.Core.Exchange{chan: chan, name: "foo"}}}
Summary
Types
config()
config() :: %{:name => binary, optional(:type) => atom, optional(:opts) => Keyword.t, optional(:export_as) => atom}
The action configuration