carotte/exchange

Types

pub opaque type Exchange
pub type ExchangeType {
  Fanout
  Direct
  Topic
  Headers
}

Constructors

  • Fanout
  • Direct
  • Topic
  • Headers

Functions

pub fn as_durable(exchange: Exchange) -> Exchange

If set, the exchange will survive a broker restart

pub fn as_internal(exchange: Exchange) -> Exchange

If set, the exchange may not be used directly by publishers, but only when bound to other exchanges. Internal exchanges are used to construct wiring that is not visible to applications

pub fn bind(
  channel channel: Channel,
  source source: String,
  destination destination: String,
  routing_key routing_key: String,
) -> Result(Nil, CarotteError)

Bind an exchange to another exchange Routing keys are used to filter messages from the source exchange

pub fn bind_async(
  channel channel: Channel,
  source source: String,
  destination destination: String,
  routing_key routing_key: String,
) -> Result(Nil, CarotteError)
pub fn declare(
  exchange: Exchange,
  channel: Channel,
) -> Result(Nil, CarotteError)

Declare an exchange on the broker

pub fn declare_async(
  exchange: Exchange,
  channel: Channel,
) -> Result(Nil, CarotteError)

Declare an exchange on the broker without waiting for a response

pub fn delete(
  channel channel: Channel,
  exchange exchange: String,
  if_unused unused: Bool,
) -> Result(Nil, CarotteError)

Delete an exchange from the broker If unused is set to true, the exchange will only be deleted if it has no queues bound to it

pub fn delete_async(
  channel channel: Channel,
  exchange exchange: String,
  unused unused: Bool,
) -> Result(Nil, CarotteError)

Delete an exchange from the broker without waiting for a response

pub fn new(name: String) -> Exchange

Create a new exchange with the given name Defaults to a direct exchange

pub fn unbind(
  channel channel: Channel,
  source source: String,
  destination destination: String,
  routing_key routing_key: String,
) -> Result(Nil, CarotteError)

Unbind an exchange from another exchange

pub fn unbind_async(
  channel channel: Channel,
  source source: String,
  destination destination: String,
  routing_key routing_key: String,
) -> Result(Nil, CarotteError)

Unbind an exchange from another exchange asynchronously. Same semantics as unbind

pub fn with_auto_delete(exchange: Exchange) -> Exchange

If set, the exchange will be deleted when the last queue is unbound from it

pub fn with_type(
  exchange: Exchange,
  exchange_type: ExchangeType,
) -> Exchange

Give the exchange a type: fanout, direct, topic, or headers

Search Document