amqp-client
Version, currently 1.3.477 versions
- 1.3.4latestJun 29, 2026
- 1.3.3not indexedJul 10, 2026
- 1.3.2not indexedJul 10, 2026
- 1.3.1not indexedJul 10, 2026
- 1.3.0not indexedJul 10, 2026
- 1.2.9not indexedJul 10, 2026
- 1.2.8not indexedJul 10, 2026
- 1.2.7not indexedJul 10, 2026
- 1.2.6not indexedJul 10, 2026
- 1.2.5not indexedJul 10, 2026
- 1.2.4not indexedJul 10, 2026
- 1.2.3not indexedJul 10, 2026
- 1.2.2not indexedJul 10, 2026
- 1.2.1not indexedJul 10, 2026
- 1.2.0not indexedJul 10, 2026
- 1.1.0not indexedJul 10, 2026
- 1.0.13not indexedJul 10, 2026
- 1.0.12not indexedJul 10, 2026
- 1.0.11not indexedJul 10, 2026
- 1.0.10not indexedJul 10, 2026
- 1.0.9not indexedJul 10, 2026
- 1.0.8not indexedJul 10, 2026
- 1.0.7not indexedJul 10, 2026
- 1.0.6not indexedJul 10, 2026
- 1.0.5not indexedJul 10, 2026
- 1.0.4not indexedJul 10, 2026
- 1.0.3not indexedJul 10, 2026
- 1.0.2not indexedJul 10, 2026
- 1.0.1not indexedJul 10, 2026
- 1.0.0not indexedJul 10, 2026
- 0.6.6not indexedJul 10, 2026
- 0.6.5not indexedJul 10, 2026
- 0.6.4not indexedJul 10, 2026
- 0.6.3not indexedJul 10, 2026
- 0.6.2not indexedJul 10, 2026
- 0.6.1not indexedJul 10, 2026
- 0.6.0not indexedJul 10, 2026
- 0.5.20not indexedJul 10, 2026
- 0.5.19not indexedJul 10, 2026
- 0.5.18not indexedJul 10, 2026
- 0.5.17not indexedJul 10, 2026
- 0.5.16not indexedJul 10, 2026
- 0.5.15not indexedJul 10, 2026
- 0.5.14not indexedJul 10, 2026
- 0.5.13not indexedJul 10, 2026
- 0.5.12not indexedJul 10, 2026
- 0.5.11not indexedJul 10, 2026
- 0.5.10not indexedJul 10, 2026
- 0.5.9not indexedJul 10, 2026
- 0.5.8not indexedJul 10, 2026
- 0.5.7not indexedJul 10, 2026
- 0.5.6not indexedJul 10, 2026
- 0.5.5not indexedJul 10, 2026
- 0.5.4not indexedJul 10, 2026
- 0.5.3not indexedJul 10, 2026
- 0.5.2not indexedJul 10, 2026
- 0.5.1not indexedJul 10, 2026
- 0.5.0not indexedJul 10, 2026
- 0.4.5not indexedJul 10, 2026
- 0.4.4not indexedJul 10, 2026
- 0.4.3not indexedJul 10, 2026
- 0.4.2not indexedJul 10, 2026
- 0.4.1not indexedJul 10, 2026
- 0.4.0not indexedJul 10, 2026
- 0.3.9not indexedJul 10, 2026
- 0.3.8not indexedJul 10, 2026
- 0.3.7not indexedJul 10, 2026
- 0.3.6not indexedJul 10, 2026
- 0.3.5not indexedJul 10, 2026
- 0.3.4not indexedJul 10, 2026
- 0.3.3not indexedJul 10, 2026
- 0.3.2not indexedJul 10, 2026
- 0.3.1not indexedJul 10, 2026
- 0.3.0not indexedJul 10, 2026
- 0.2.2not indexedJul 10, 2026
- 0.2.1not indexedJul 10, 2026
- 0.2.0not indexedJul 10, 2026
github.com/cloudamqp/amqp-client.cr
An AMQP 0-9-1 client for Crystal
73 stars
3 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
amqp-client:
github: cloudamqp/amqp-client.cr
version: ~> 1.3.4Then run:
shards installshard.yml
- Crystal
>= 1.0.0- License
- MIT
- Authors
- Carl Hörberg <carl@cloudamqp.com>, Anders Bälter <anders@cloudamqp.com>
Dependencies
Runtime Dependencies
- amq-protocol*github: cloudamqp/amq-protocol.cr
Development Dependencies
- ameba*github: crystal-ameba/amebadev
README
# amqp-client
An AMQP 0-9-1 client for Crystal.
## Installation
1. Add the dependency to your `shard.yml`:
```yaml
dependencies:
amqp-client:
github: cloudamqp/amqp-client.cr
```
2. Run `shards install`
## Usage
```crystal
require "amqp-client"
AMQP::Client.start("amqp://guest:guest@localhost") do |c|
c.channel do |ch|
# Always set a prefetch limit before consuming
ch.prefetch(100)
# Declare a temporary queue
q = ch.queue("")
# Declare a durable queue
q = ch.queue("my-queue")
# Subscribe to it, and manually acknowledge messages when processed
q.subscribe(no_ack: false) do |msg|
puts "Received: #{msg.body_io.to_s}"
ch.basic_ack(msg.delivery_tag)
end
# publish directly to a queue without confirm (fire and forget)
q.publish "msg"
# publish directly to a queue and blocking while waiting for confirm
q.publish_confirm "msg"
# publish to any exchange/routing-key (fire and forget)
ch.basic_publish "msg", exchange: "amq.topic", routing_key: "a"
# publish to any exchange/routing-key and block while waiting for confirm
ch.basic_publish_confirm "msg", exchange: "amq.topic", routing_key: "a"
# When the Channel is in confirm mode a block can be given to the basic_publish
# method and it will be executed when the message is confirmed by the server
ch.confirm_select
ch.basic_publish("msg", "amq.topic", "my.topic") do |ok|
if ok
puts "Message is confirmed by the server"
else
puts "Message was NOT confirmed by the server"
end
end
# This statement will block until a message has arrived
# The only way to "escape" the block is to unsubscribe
q.subscribe(tag: "myconsumer", block: true) do |msg|
q.unsubscribe("myconsumer")
end
# Consume and ack, nack or reject msgs
ch.basic_consume("queue", tag: "consumer-tag", no_ack: false, exclusive: false, block: false) do |msg|
case msg.body_io.to_s
when "ack"
ch.basic_ack(msg.delivery_tag)
when "reject"
ch.basic_reject(msg.delivery_tag, requeue: true)
when "nack"
ch.basic_nack(msg.delivery_tag, requeue: true, multiple: true)
end
end
ch.prefetch(count: 1000) # alias for basic_qos
name, message_count, consumer_count =
ch.queue_declare(name: "myqueue", passive: false, durable: true,
exclusive: false, auto_delete: false)
q = ch.queue # temporary queue that is deleted when the channel is closed
ch.queue_purge("myqueue")
ch.queue_bind("myqueue", "amq.topic", "routing-key")
ch.queue_unbind("myqueue", "amq.topic", "routing-key")
msg = ch.basic_get("myqueue", no_ack: true)
ch.basic_ack(msg.delivery_tag)
ch.queue_delete("myqueue")
ch.exchange_declare("my-exchange", type: "topic")
ch.exchange_delete("my-exchange")
end
end
```
You can consume [stream queues](https://www.rabbitmq.com/streams.html) too:
```crystal
require "amqp-client"
AMQP::Client.start do |c|
c.channel do |ch|
# prefetch required when consuming from stream queues
ch.prefetch(10)
# declare a stream queue using the x-queue-type argument
q = ch.queue("stream1", args: AMQP::Client::Arguments.new({"x-queue-type": "stream"}))
puts "Waiting for messages. To exit press CTRL+C"
# Decide from where to subscribe using the x-stream-offset argument
q.subscribe(block: true, no_ack: false, args: AMQP::Client::Arguments.new({"x-stream-offset": "first"})) do |msg|
puts "Received: #{msg.body_io}"
msg.ack
end
end
end
```
## Performance
1-byte messages, without properties/headers:
| Publish rate | Consume rate |
| ------------ | ------------ |
| 1.200.000 msgs/s | 1.000.000 msgs/s |
## Contributing
1. [Fork it](https://github.com/cloudamqp/amqp-client.cr/fork)
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request
## Contributors
- [Carl Hörberg](https://github.com/carlhoerberg) - creator and maintainer
- [Anders Bälter](https://github.com/baelter)
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
1.3.4- Tagged
- Jun 29, 2026
- Commit
b3128731eb7e- Crystal
>= 1.0.0- Indexed
- yes
Dependents
Repository
github.com/cloudamqp/amqp-client.cr
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 12, 2026
- Synced
- Aug 12, 2026
- Versions
- 77