Skip to content
An AMQP 0-9-1 client for Crystal
Crystal
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs updated docs Sep 11, 2019
spec lazy table adaptation Jul 10, 2019
src version bump Jul 21, 2019
.gitignore add docs/ Feb 4, 2019
.travis.yml travis: rabbitmq apt package Sep 11, 2019
LICENSE copyright 2019 84codes AB Feb 25, 2019
README.md Take credit Jun 18, 2019
shard.yml version bump Jul 21, 2019

README.md

Build Status

amqp-client

An AMQP 0-9-1 client for Crystal.

Installation

  1. Add the dependency to your shard.yml:
dependencies:
  amqp-client:
    github: cloudamqp/amqp-client.cr
  1. Run shards install

Usage

require "amqp-client"

AMQP::Client.start("amqp://guest:guest@localhost") do |c|
  c.channel do |ch|
    q = ch.queue("my-queue")
    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
    q.publish "msg"

    # publish directly to a queue, blocking while waiting for confirm
    q.publish_confirm "msg"

    # publish to any exchange/routing-key
    ch.basic_publish "msg", exchange: "amq.topic", routing_key: "a"

    # publish to any exchange/routing-key and wait for confirm
    ch.basic_publish_confirm "msg", exchange: "amq.topic", routing_key: "a"
  end
end

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

You can’t perform that action at this time.