HareMq.Exchange (hare_mq v1.4.0)

Copy Markdown

Module providing functions for managing RabbitMQ exchanges.

This module includes functions for declaring and binding exchanges.

Summary

Functions

Bind a RabbitMQ exchange to a destination.

Declare a RabbitMQ exchange.

Functions

bind(config)

Bind a RabbitMQ exchange to a destination.

Parameters

  • :channel: The AMQP channel.
  • :destination: The name of the destination exchange or queue.
  • :source: The name of the source exchange.
  • :routing_key: The routing key.

Examples

HareMq.Exchange.bind(channel: channel, destination: "destination_exchange", source: "my_exchange", routing_key: "my_routing_key")

declare(list)

Declare a RabbitMQ exchange.

The 3-option form accepts an explicit :type. The 2-option form uses the type configured under config :hare_mq, :exchange_type (default :direct).

Parameters

  • :channel: The AMQP channel.
  • :name: The name of the exchange.
  • :type: (3-option form only) The exchange type, e.g. :direct, :topic, :fanout.

Examples

# Explicit type
HareMq.Exchange.declare(channel: channel, name: "my_exchange", type: :topic)

# Type from config :hare_mq, :exchange_type (default :direct)
HareMq.Exchange.declare(channel: channel, name: "my_exchange")