hare v0.2.2 Hare.Context.Action.DeclareServerNamedQueue
This module implements a Hare.Context.Action
behaviour to
declare a server-named queue on the AMQP server.
Config
Configuration must be a Keyword.t
with the following fields:
:opts
- (defaults to[]
) the options to be given to the adapter:export_as
- (defaults tonil
) the key to export the declared queue to
The :export_as
config allows the action to export a Hare.Core.Queue
struct to be used later by other steps (for example: to bind it to an exchange).
alias Hare.Context.Action.DeclareServerNamedQueue
config = [opts: [durable: true],
export_as: :q]
exports = %{}
DeclareServerNamedQueue.run(chan, config, exports)
# => {:ok, %{...}, %{q: %Hare.Core.Queue{chan: chan, name: "as32jklqqas="}}}
Summary
Types
The action configuration
Functions
Runs the action.
It receives a open AMQP channel, the config of the action, and the exports map, containing data from previous run actions.
It may return 4 possible values:
:ok
- On success (info is %{} by default){:ok, info}
- On success, providing some info about the execution of the step{:ok, info, exports}
- On success, providing some info, with a modified exports map{:error, reason}
- On error
Callback implementation for Hare.Context.Action.run/3
.
Validates the given config format.
It must return :ok
if config is valid, and {:error, reason}
if
it is invalid.
Callback implementation for Hare.Context.Action.validate/1
.