gamqp/amqp091/queue

Queues hold messages until consumers take them.

Types

pub type DeclareOptions {
  DeclareOptions(
    durable: Bool,
    exclusive: Bool,
    auto_delete: Bool,
    passive: Bool,
    arguments: List(#(String, table.FieldValue)),
  )
}

Constructors

  • DeclareOptions(
      durable: Bool,
      exclusive: Bool,
      auto_delete: Bool,
      passive: Bool,
      arguments: List(#(String, table.FieldValue)),
    )

    Arguments

    exclusive

    Only this connection may use it; deleted when the connection closes.

    auto_delete

    Deleted once its last consumer goes away.

    passive

    Only check that the queue exists (404 otherwise).

    arguments

    Queue arguments, e.g. x-queue-type, x-message-ttl, x-dead-letter-exchange.

pub type Declared {
  Declared(name: String, message_count: Int, consumer_count: Int)
}

Constructors

  • Declared(name: String, message_count: Int, consumer_count: Int)

    Arguments

    name

    The queue name, generated by the broker when you declared “”.

Values

pub fn bind(
  channel: client.Channel,
  queue queue: String,
  exchange exchange: String,
  routing_key routing_key: String,
  arguments arguments: List(#(String, table.FieldValue)),
) -> Result(Nil, core.AmqpError)
pub fn check(
  channel: client.Channel,
  name: String,
) -> Result(Declared, core.AmqpError)

Fails with ChannelClosed(404, _) when the queue does not exist.

pub fn declare(
  channel: client.Channel,
  name: String,
  options: DeclareOptions,
) -> Result(Declared, core.AmqpError)
pub fn declare_options() -> DeclareOptions

A durable queue that is not exclusive and stays when unused.

pub fn delete(
  channel: client.Channel,
  queue: String,
  if_unused if_unused: Bool,
  if_empty if_empty: Bool,
) -> Result(Int, core.AmqpError)

Deletes the queue and returns how many messages it still held.

pub fn purge(
  channel: client.Channel,
  queue: String,
) -> Result(Int, core.AmqpError)

Drops every ready message and returns how many there were.

pub fn temporary_options() -> DeclareOptions

A broker-named, exclusive, auto-delete queue: the usual reply or fan-out subscriber queue. Declare it with the name “”.

pub fn unbind(
  channel: client.Channel,
  queue queue: String,
  exchange exchange: String,
  routing_key routing_key: String,
  arguments arguments: List(#(String, table.FieldValue)),
) -> Result(Nil, core.AmqpError)
✨ Search Document