crystal-amqp-example
Version, currently main branch1 version
- main branchlatestOct 16, 2026
github.com/cloudamqp/crystal-amqp-example
Example of Crystal with LavinMQ or RabbitMQ
The last crawl could not reach this repository on its host: cloudamqp/crystal-amqp-example is not a repository this token can see. The entry stays because repositories come back, and because other shards still link to it.
Installation
# Add this to your shard.yml
dependencies:
crystal-amqp-example:
github: cloudamqp/crystal-amqp-example
branch: mainmain is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
>= 1.0.0- Targets
workerfrom src/worker.crpublisherfrom src/publisher.cr
Dependencies
Runtime Dependencies
- amqp-client~> 1.3github: cloudamqp/amqp-client.cr
Development Dependencies
- ameba*github: crystal-ameba/amebadev
README
Use CloudAMQP from Crystal
A minimal example of publishing and consuming messages with amqp-client.cr, against CloudAMQP or any AMQP 0-9-1 broker such as LavinMQ or RabbitMQ.
All AMQP code is in src/example.cr:
publishpublishes a persistent message and blocks until the broker has confirmed it. amqp-client.cr publishes transient messages unlessdelivery_mode: 2is set.consumeconsumes with a prefetch of 10, acking each message after the block returns.subscribeacks automatically unlessno_ack: falseis passed.connectconnects using theCLOUDAMQP_URLenvironment variable, and verifies the server certificate foramqps://URLs.
amqp-client.cr doesn't reconnect: if the connection is lost, the programs exit.
Usage
Tool versions are in mise.toml; install them with mise,
or use any Crystal 1.x.
shards build
export CLOUDAMQP_URL="amqps://user:password@host/vhost"
bin/worker # in one terminal
bin/publisher # in another
Without CLOUDAMQP_URL it connects to amqp://guest:guest@localhost.
Tests
crystal spec publishes and consumes a message through a real broker on
localhost. CI runs it against LavinMQ, together with crystal tool format and
ameba.
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
main- Seen
- Oct 16, 2026
- Crystal
>= 1.0.0- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/cloudamqp/crystal-amqp-example
This repository could not be reached on its host the last time we looked.
Metadata
- Created
- Oct 17, 2026
- Updated
- Nov 22, 2026
- Synced
- Oct 17, 2026
- Versions
- 1