README.md in amqp-client-1.1.4 vs README.md in amqp-client-1.1.5
- old
+ new
@@ -47,10 +47,14 @@
### High level API
The library provides a high-level API that is a bit easier to get started with, and also handles reconnection automatically.
```ruby
+require "amqp-client"
+require "json"
+require "zlib"
+
# Start the client, it will connect and once connected it will reconnect if that connection is lost
# Operation pending when the connection is lost will raise an exception (not timeout)
amqp = AMQP::Client.new("amqp://localhost").start
# Declares a durable queue
@@ -60,13 +64,14 @@
myqueue.bind("amq.topic", "my.events.*")
# The message will be reprocessed if the client loses connection to the broker
# between message arrival and when the message was supposed to be ack'ed.
myqueue.subscribe(prefetch: 20) do |msg|
- process(JSON.parse(msg.body))
+ puts JSON.parse(msg.body)
msg.ack
-rescue
+rescue => e
+ puts e.full_message
msg.reject(requeue: false)
end
# Publish directly to the queue
myqueue.publish({ foo: "bar" }.to_json, content_type: "application/json")
@@ -74,20 +79,31 @@
# Publish to any exchange
amqp.publish("my message", "amq.topic", "topic.foo", headers: { foo: 'bar' })
amqp.publish(Zlib.gzip("an event"), "amq.topic", "my.event", content_encoding: 'gzip')
```
+## Benchmark
+
+1 byte messages:
+
+| Client | Publish rate | Consume rate | Memory usage |
+| ------ | ------------ | ------------ | ------------ |
+| amqp-client.rb | 237.000 msgs/s | 154.000 msgs/s | 23 MB |
+| bunny | 39.000 msgs/s | 44.000 msgs/s | 31 MB |
+
+Gem comparison:
+
+| Client | Runtime dependencies | [Lines of code](https://github.com/AlDanial/cloc) |
+| --- | --- | --- |
+| amqp-client.rb | 0 | 1876 |
+| bunny | 2 | 4003 |
+
## Supported Ruby versions
All maintained Ruby versions are supported.
-- 3.1
-- 3.0
-- 2.7
-- 2.6
-- jruby
-- truffleruby
+See the [CI workflow](https://github.com/cloudamqp/amqp-client.rb/blob/main/.github/workflows/main.yml) for the exact versions.
## Installation
Add this line to your application's Gemfile:
@@ -105,10 +121,10 @@
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
-To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
+To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the changelog and version number in `version.rb`, make a commit, and then run `bundle exec rake release:source_control_push`, which will create a git tag for the version, push git commits and the created tag. GitHub Actions will then push the `.gem` file to [rubygems.org](https://rubygems.org).
## Contributing
Bug reports and pull requests are welcome on GitHub at [https://github.com/cloudamqp/amqp-client.rb](https://github.com/cloudamqp/amqp-client.rb/)