Skip to content

Commit

Permalink
Merge pull request #702 from ruby-amqp/bunny-701
Browse files Browse the repository at this point in the history
Drop JRuby support
  • Loading branch information
michaelklishin authored Feb 21, 2025
2 parents f6a8e9d + 75d6e85 commit 0eea277
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 339 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Gemfile.lock
.tags
.tags_sorted_by_file
.Apple*
/bin/*
.bundle/*
vendor/*
playground/*
Expand Down
51 changes: 26 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,28 @@ Specific examples:

Modern Bunny versions support

* CRuby 2.7 through 3.3 (inclusive)
* CRuby 3.2 through 3.4 (inclusive)
* [TruffleRuby](https://www.graalvm.org/ruby/)

For environments that use TLS, Bunny expects Ruby installations to use a recent enough OpenSSL version that
**includes support for [TLS 1.3](https://www.rabbitmq.com/docs/ssl#tls1.3)**.

### JRuby

Bunny works sufficiently well on JRuby but there are known
JRuby bugs in versions prior to JRuby 9000 that cause high CPU burn. JRuby users should
use [March Hare](http://rubymarchhare.info).
Bunny no longer supports JRuby.

Bunny `1.7.x` was the last version to support CRuby 1.9.3 and 1.8.7
JRuby users should use [March Hare](http://rubymarchhare.info), which has a similar API
and is built on top of the RabbitMQ Java client specifically for JRuby.


## Supported RabbitMQ Versions

Modern Bunny releases target [currently supported RabbitMQ release series](https://www.rabbitmq.com/versions.html).
Modern Bunny releases target [currently community supported RabbitMQ release series](https://www.rabbitmq.com/release-information).

The protocol implemented by Bunny was first introduced in RabbitMQ 2.0 and has evolved
via extensions and with next to no breaking changes, so all key Bunny operations can be used with a wide range
of RabbitMQ versions, accounting for the few potentially breaking changes they
may introduce, e.g. the idempotency of `queue.delete` operations.


## Change Log
Expand Down Expand Up @@ -143,7 +147,7 @@ conn.close

### Getting Started

For a 15 minute tutorial using more practical examples, see [Getting Started with RabbitMQ and Ruby using Bunny](http://rubybunny.info/articles/getting_started.html).
For a 15 minute tutorial using more practical examples, see [Getting Started with RabbitMQ and Ruby using Bunny](https://github.com/ruby-amqp/bunny/blob/main/docs/guides/getting_started.md).

### Guides

Expand All @@ -161,15 +165,15 @@ Bunny documentation guides are [under `docs/guides` in this repository](https://

Some highly relevant RabbitMQ documentation guides:

* [Connections](https://www.rabbitmq.com/connections.html)
* [Channels](https://www.rabbitmq.com/channels.html)
* [Queues](https://www.rabbitmq.com/queues.html)
* [Quorum queues](https://www.rabbitmq.com/quorum-queues.html)
* [Streams](https://rabbitmq.com/streams.html) (Bunny can perform basic operations on streams even though it does not implement the [RabbitMQ Stream protocol](https://github.com/rabbitmq/rabbitmq-server/blob/v3.10.x/deps/rabbitmq_stream/docs/PROTOCOL.adoc))
* [Publishers](https://www.rabbitmq.com/publishers.html)
* [Consumers](https://www.rabbitmq.com/consumers.html)
* Data safety: publisher and consumer [Confirmations](https://www.rabbitmq.com/confirms.html)
* [Production Checklist](https://www.rabbitmq.com/production-checklist.html)
* [Connections](https://www.rabbitmq.com/docs/connections)
* [Channels](https://www.rabbitmq.com/docs/channels)
* [Queues](https://www.rabbitmq.com/docs/queues)
* [Quorum queues](https://www.rabbitmq.com/docs/quorum-queues)
* [Streams](https://rabbitmq.com/docs/streams) (Bunny can perform basic operations on streams even though it does not implement the [RabbitMQ Stream protocol](https://github.com/rabbitmq/rabbitmq-server/blob/v4.0.x/deps/rabbitmq_stream/docs/PROTOCOL.adoc))
* [Publishers](https://www.rabbitmq.com/docs/publishers)
* [Consumers](https://www.rabbitmq.com/docs/consumers)
* Data safety: publisher and consumer [Confirmations](https://www.rabbitmq.com/docs/confirms)
* [Production Checklist](https://www.rabbitmq.com/docs/production-checklist)

### API Reference

Expand All @@ -180,17 +184,14 @@ Some highly relevant RabbitMQ documentation guides:

### Mailing List

[Bunny has a mailing list](http://groups.google.com/group/ruby-amqp). Please use it for all questions,
investigations, and discussions. GitHub issues should be used for specific, well understood, actionable
maintainers and contributors can work on.

We encourage you to also join the [RabbitMQ mailing list](https://groups.google.com/forum/#!forum/rabbitmq-users)
mailing list. Feel free to ask any questions that you may have.

Please use [GitHub Discussions](https://github.com/ruby-amqp/bunny/discussions) for questions.

## Continuous Integration
GitHub issues should be used for specific, well understood, actionable
maintainers and contributors can work on.

[![Build Status](https://travis-ci.org/ruby-amqp/bunny.svg)](https://travis-ci.org/ruby-amqp/bunny/)
We encourage you to keep an eye on [RabbitMQ Discussions](https://github.com/rabbitmq/rabbitmq-server/discussions),
join the [RabbitMQ mailing list](https://groups.google.com/forum/#!forum/rabbitmq-users)
and the [RabbitMQ Discord server](https://rabbitmq.com/discord).


### Reporting Issues
Expand Down
22 changes: 5 additions & 17 deletions lib/bunny/channel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@
require "bunny/return_info"
require "bunny/message_properties"

if defined?(JRUBY_VERSION)
require "bunny/concurrent/linked_continuation_queue"
else
require "bunny/concurrent/continuation_queue"
end
require "bunny/concurrent/continuation_queue"

module Bunny
# ## Channels in RabbitMQ
Expand Down Expand Up @@ -2113,18 +2109,10 @@ def reset_continuations
@basic_get_continuations = new_continuation
end


if defined?(JRUBY_VERSION)
# @private
def new_continuation
Concurrent::LinkedContinuationQueue.new
end
else
# @private
def new_continuation
Concurrent::ContinuationQueue.new
end
end # if defined?
# @private
def new_continuation
Concurrent::ContinuationQueue.new
end

# @private
def guarding_against_stale_delivery_tags(tag, &block)
Expand Down
63 changes: 0 additions & 63 deletions lib/bunny/concurrent/linked_continuation_queue.rb

This file was deleted.

59 changes: 0 additions & 59 deletions lib/bunny/jruby/socket.rb

This file was deleted.

60 changes: 0 additions & 60 deletions lib/bunny/jruby/ssl_socket.rb

This file was deleted.

30 changes: 5 additions & 25 deletions lib/bunny/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@
require "bunny/authentication/plain_mechanism_encoder"
require "bunny/authentication/external_mechanism_encoder"

if defined?(JRUBY_VERSION)
require "bunny/concurrent/linked_continuation_queue"
else
require "bunny/concurrent/continuation_queue"
end
require "bunny/concurrent/continuation_queue"

require "amq/protocol/client"
require "amq/settings"
Expand Down Expand Up @@ -1080,16 +1076,7 @@ def maybe_shutdown_reader_loop
# this is the easiest way to wait until the loop
# is guaranteed to have terminated
@reader_loop.terminate_with(ShutdownSignal)
# joining the thread here may take forever
# on JRuby because sun.nio.ch.KQueueArrayWrapper#kevent0 is
# a native method that cannot be (easily) interrupted.
# So we use this ugly hack or else our test suite takes forever
# to run on JRuby (a new connection is opened/closed per example). MK.
if defined?(JRUBY_VERSION)
sleep 0.075
else
@reader_loop.join
end
@reader_loop.join
else
# single threaded mode, nothing to do. MK.
end
Expand Down Expand Up @@ -1413,16 +1400,9 @@ def credentials_encoder_for(mechanism)
Authentication::CredentialsEncoder.for_session(self)
end

if defined?(JRUBY_VERSION)
# @private
def reset_continuations
@continuations = Concurrent::LinkedContinuationQueue.new
end
else
# @private
def reset_continuations
@continuations = Concurrent::ContinuationQueue.new
end
# @private
def reset_continuations
@continuations = Concurrent::ContinuationQueue.new
end

# @private
Expand Down
19 changes: 6 additions & 13 deletions lib/bunny/socket.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
# frozen_string_literal: true

# See #165. MK.
if defined?(JRUBY_VERSION)
require "bunny/jruby/socket"
require "bunny/cruby/socket"

module Bunny
SocketImpl = JRuby::Socket
end
else
require "bunny/cruby/socket"

module Bunny
SocketImpl = Socket
end
end
module Bunny
# An alias for the standard MRI Socket,
# exists from the days of JRuby support.
SocketImpl = Socket
end
Loading

0 comments on commit 0eea277

Please sign in to comment.