Skip to content

renatillas/carotte

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🥕 Carotte

A RabbitMQ client for Gleam

Package Version Hex Docs

gleam add carotte
import carotte
import carotte/channel
import carotte/exchange
import carotte/queue
import carotte/publisher

pub fn main() {
  let assert Ok(client) =
    carotte.default_client()
    |> carotte.start()

  let assert Ok(channel) =
    channel.open_channel(client)

  exchange.new("consume_exchange")
  |> exchange.declare(channel)
  queue.new("consume_queue")
  |> queue.declare(channel)

  queue.bind(
    channel: channel,
    queue: "consume_queue",
    exchange: "consume_exchange",
    routing_key: "",
  )

  publisher.publish(
    channel: channel,
    exchange: "consume_exchange",
    routing_key: "",
    payload: "payload",
    options: [],
  )

  queue.subscribe(
    channel: channel,
    queue: "consume_queue",
    callback: fn(payload, _) {
      payload.payload
      |> should.equal("payload")
    },
  )
}

Further documentation can be found at https://hexdocs.pm/carotte.

Development

gleam run   # Run the project
gleam test  # Run the tests

About

A RabbitMQ client library for Gleam!

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •