hare v0.2.2 Hare.Adapter.Sandbox

Sandbox implementation for the Hare.Adapter behaviour.

It is meant to be used only on tests.

This adapter allows the developer to inspect its history and modify its behaviour during tests throught the Hare.Adapter.Sandbox.Backdoor module.

Check Hare.Adapter.Sandbox.Backdoor for more information.

Summary

Functions

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 a server-named 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

Functions

ack(chan, meta, opts)

Acks a message given its meta

Callback implementation for Hare.Adapter.ack/3.

bind(chan, queue, exchange, opts)

Binds a queue to an exchange

Callback implementation for Hare.Adapter.bind/4.

cancel(chan, consumer_tag, opts)

Cancels the consumer with the given consumer_tag

Callback implementation for Hare.Adapter.cancel/3.

close_channel(chan)

Closes a channel

Callback implementation for Hare.Adapter.close_channel/1.

close_connection(conn)

Closes the AMQP connection.

Callback implementation for Hare.Adapter.close_connection/1.

consume(chan, queue, pid, opts)

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.

Callback implementation for Hare.Adapter.consume/4.

declare_exchange(chan, exchange, type, opts)

Declares an exchange

Callback implementation for Hare.Adapter.declare_exchange/4.

declare_queue(chan, queue, opts)

Declares a queue

Callback implementation for Hare.Adapter.declare_queue/3.

declare_server_named_queue(chan, opts)

Declares a server-named queue

Callback implementation for Hare.Adapter.declare_server_named_queue/2.

delete_exchange(chan, exchange, opts)

Deletes an exchange

Callback implementation for Hare.Adapter.delete_exchange/3.

delete_queue(chan, queue, opts)

Deletes a queue

Callback implementation for Hare.Adapter.delete_queue/3.

get(chan, queue, opts)

Gets a message from a queue

Callback implementation for Hare.Adapter.get/3.

handle(message)

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

Callback implementation for Hare.Adapter.handle/1.

monitor_channel(chan)

Monitors the process representing the channel

Callback implementation for Hare.Adapter.monitor_channel/1.

monitor_connection(conn)

Monitors the process representing the AMQP connection.

Callback implementation for Hare.Adapter.monitor_connection/1.

nack(chan, meta, opts)

Nacks a message given its meta

Callback implementation for Hare.Adapter.nack/3.

open_channel(conn)

Opens a channel through the given connection

Callback implementation for Hare.Adapter.open_channel/1.

open_connection(config)

Establishes connection with the AMQP server using the given config.

Callback implementation for Hare.Adapter.open_connection/1.

publish(chan, exchange, payload, routing_key, opts)

Publishes a message to an exchange

Callback implementation for Hare.Adapter.publish/5.

purge(chan, queue)

Purges all messages in a queue

Callback implementation for Hare.Adapter.purge/2.

qos(chan, opts)

Sets the Quality Of Service of the channel

Callback implementation for Hare.Adapter.qos/2.

recover(chan, opts)
register_return_handler(chan, pid)
reject(chan, meta, opts)

Rejects a message given its meta

Callback implementation for Hare.Adapter.reject/3.

unbind(chan, queue, exchange, opts)

Unbinds a queue from an exchange

Callback implementation for Hare.Adapter.unbind/4.

unregister_return_handler(chan)