hare v0.2.2 Hare.Adapter behaviour
Specification of the AMQP adapter
Summary
Callbacks
Acks a message given its meta
Binds a queue to an exchange
Cancels the consumer with the given consumer_tag
Closes a channel
Closes the AMQP connection
Consumes messages from a queue
Declares an exchange
Declares a queue
Declares a server-named queue
Deletes an exchange
Deletes a queue
Gets a message from a queue
Transforms a message received by a consumed pid into one of the well defined terms expected by consumers
Links the caller to the process representing the channel
Monitors the process representing the channel
Monitors the process representing the AMQP connection
Nacks a message given its meta
Opens a channel through the given connection
Establishes connection with the AMQP server using the given config
Publishes a message to an exchange
Purges all messages in a queue
Sets the Quality Of Service of the channel
Rejects a message given its meta
Unbinds a queue from an exchange
Unlinks the caller to the process representing the channel
Types
Callbacks
Binds a queue to an exchange
Cancels the consumer with the given consumer_tag
Closes a channel
Closes the AMQP connection.
Consumes messages from a queue.
Once a pid is consuming a queue status messages and actual queue messages must be sent to the consuming pid as elixir messages in a adapter-specific format.
The function handle/2
should receive that elixir messages and transform them into
well defined terms.
declare_exchange(chan, exchange_name, exchange_type, opts) :: :ok | {:error, reason :: term}
Declares an exchange
declare_queue(chan, queue_name, opts) :: {:ok, info :: term} | {:error, term}
Declares a queue
declare_server_named_queue(chan, opts) :: {:ok, queue_name, info :: term} | {:error, term}
Declares a server-named queue
Deletes an exchange
Deletes a queue
get(chan, queue_name, opts) :: {:empty, info :: map} | {:ok, payload, meta}
Gets a message from a queue
Transforms a message received by a consumed pid into one of the well defined terms expected by consumers.
The expected terms are:
{:consume_ok, meta}
-consume-ok
message sent by the AMQP server when a consumer is started{:deliver, payload, meta}
- an actual message from the queue being consumed{:cancel_ok, meta}
-cancel-ok
message sent by the AMQP server when a consumer is started{:cancel, meta}
-cancel
message sent by the AMQP server when a consumer has been unexpectedly closed:unknown
- any other message
Links the caller to the process representing the channel
Monitors the process representing the channel
Monitors the process representing the AMQP connection.
Opens a channel through the given connection
Establishes connection with the AMQP server using the given config.
publish(chan, exchange_name, payload, routing_key, opts) :: :ok
Publishes a message to an exchange
Purges all messages in a queue
Unbinds a queue from an exchange
Unlinks the caller to the process representing the channel