gamqp

gamqp is an AMQP 0-9-1 client written in Gleam, talking to the broker directly over TCP or TLS. It is tested against RabbitMQ.

import gamqp/amqp091/basic
import gamqp/amqp091/channel
import gamqp/amqp091/connection
import gamqp/amqp091/message
import gamqp/amqp091/queue

pub fn main() {
  let assert Ok(config) = connection.from_uri("amqp://guest:guest@localhost")
  let assert Ok(conn) = connection.open(config)
  let assert Ok(ch) = channel.open(conn)
  let assert Ok(_) = queue.declare(ch, "hello", queue.declare_options())
  let assert Ok(_) =
    basic.publish(
      ch,
      exchange: "",
      routing_key: "hello",
      message: message.text("Hello, world!"),
      options: basic.publish_options(),
    )
  let assert Ok(_) = connection.close(conn)
}

Modules follow the protocol’s classes: connection, channel, exchange, queue, basic, confirm and tx.

Values

pub const version: String

The library version, also sent to the broker in the client properties.

✨ Search Document