bunny 1.7.0 → 2.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.github/ISSUE_TEMPLATE.md +18 -0
- data/.gitignore +6 -1
- data/.rspec +1 -3
- data/.travis.yml +21 -14
- data/CONTRIBUTING.md +132 -0
- data/ChangeLog.md +745 -1
- data/Gemfile +13 -13
- data/LICENSE +1 -1
- data/README.md +41 -75
- data/Rakefile +54 -0
- data/bunny.gemspec +4 -10
- data/docker-compose.yml +28 -0
- data/docker/Dockerfile +24 -0
- data/docker/apt/preferences.d/erlang +3 -0
- data/docker/apt/sources.list.d/bintray.rabbitmq.list +2 -0
- data/docker/docker-entrypoint.sh +26 -0
- data/docker/rabbitmq.conf +29 -0
- data/examples/connection/automatic_recovery_with_basic_get.rb +1 -1
- data/examples/connection/automatic_recovery_with_client_named_queues.rb +1 -1
- data/examples/connection/automatic_recovery_with_multiple_consumers.rb +1 -1
- data/examples/connection/automatic_recovery_with_republishing.rb +1 -1
- data/examples/connection/automatic_recovery_with_server_named_queues.rb +1 -1
- data/examples/connection/channel_level_exception.rb +1 -9
- data/examples/connection/disabled_automatic_recovery.rb +1 -1
- data/examples/connection/heartbeat.rb +1 -1
- data/examples/consumers/high_and_low_priority.rb +1 -1
- data/examples/guides/extensions/alternate_exchange.rb +2 -0
- data/examples/guides/getting_started/hello_world.rb +2 -0
- data/examples/guides/getting_started/weathr.rb +2 -0
- data/examples/guides/queues/one_off_consumer.rb +2 -0
- data/examples/guides/queues/redeliveries.rb +2 -0
- data/lib/bunny.rb +6 -2
- data/lib/bunny/channel.rb +192 -109
- data/lib/bunny/channel_id_allocator.rb +6 -4
- data/lib/bunny/concurrent/continuation_queue.rb +34 -13
- data/lib/bunny/consumer_work_pool.rb +34 -6
- data/lib/bunny/cruby/socket.rb +29 -16
- data/lib/bunny/cruby/ssl_socket.rb +20 -7
- data/lib/bunny/exceptions.rb +7 -1
- data/lib/bunny/exchange.rb +11 -7
- data/lib/bunny/get_response.rb +1 -1
- data/lib/bunny/heartbeat_sender.rb +3 -2
- data/lib/bunny/jruby/socket.rb +23 -6
- data/lib/bunny/jruby/ssl_socket.rb +5 -0
- data/lib/bunny/queue.rb +12 -10
- data/lib/bunny/reader_loop.rb +31 -18
- data/lib/bunny/session.rb +389 -134
- data/lib/bunny/test_kit.rb +14 -0
- data/lib/bunny/timeout.rb +1 -12
- data/lib/bunny/transport.rb +114 -67
- data/lib/bunny/version.rb +1 -1
- data/repl +1 -1
- data/spec/config/rabbitmq.conf +13 -0
- data/spec/higher_level_api/integration/basic_ack_spec.rb +154 -22
- data/spec/higher_level_api/integration/basic_cancel_spec.rb +77 -11
- data/spec/higher_level_api/integration/basic_consume_spec.rb +60 -55
- data/spec/higher_level_api/integration/basic_consume_with_objects_spec.rb +6 -6
- data/spec/higher_level_api/integration/basic_get_spec.rb +31 -7
- data/spec/higher_level_api/integration/basic_nack_spec.rb +22 -19
- data/spec/higher_level_api/integration/basic_publish_spec.rb +11 -100
- data/spec/higher_level_api/integration/basic_qos_spec.rb +32 -4
- data/spec/higher_level_api/integration/basic_reject_spec.rb +94 -16
- data/spec/higher_level_api/integration/basic_return_spec.rb +4 -4
- data/spec/higher_level_api/integration/channel_close_spec.rb +51 -10
- data/spec/higher_level_api/integration/channel_open_spec.rb +12 -12
- data/spec/higher_level_api/integration/connection_recovery_spec.rb +412 -286
- data/spec/higher_level_api/integration/connection_spec.rb +284 -134
- data/spec/higher_level_api/integration/connection_stop_spec.rb +31 -19
- data/spec/higher_level_api/integration/consumer_cancellation_notification_spec.rb +17 -17
- data/spec/higher_level_api/integration/dead_lettering_spec.rb +14 -14
- data/spec/higher_level_api/integration/exchange_bind_spec.rb +5 -5
- data/spec/higher_level_api/integration/exchange_declare_spec.rb +32 -31
- data/spec/higher_level_api/integration/exchange_delete_spec.rb +12 -12
- data/spec/higher_level_api/integration/exchange_unbind_spec.rb +5 -5
- data/spec/higher_level_api/integration/exclusive_queue_spec.rb +5 -5
- data/spec/higher_level_api/integration/heartbeat_spec.rb +4 -4
- data/spec/higher_level_api/integration/message_properties_access_spec.rb +49 -49
- data/spec/higher_level_api/integration/predeclared_exchanges_spec.rb +2 -2
- data/spec/higher_level_api/integration/publisher_confirms_spec.rb +92 -27
- data/spec/higher_level_api/integration/publishing_edge_cases_spec.rb +19 -19
- data/spec/higher_level_api/integration/queue_bind_spec.rb +23 -23
- data/spec/higher_level_api/integration/queue_declare_spec.rb +129 -34
- data/spec/higher_level_api/integration/queue_delete_spec.rb +2 -2
- data/spec/higher_level_api/integration/queue_purge_spec.rb +5 -5
- data/spec/higher_level_api/integration/queue_unbind_spec.rb +6 -6
- data/spec/higher_level_api/integration/read_only_consumer_spec.rb +9 -9
- data/spec/higher_level_api/integration/sender_selected_distribution_spec.rb +10 -10
- data/spec/higher_level_api/integration/tls_connection_spec.rb +218 -112
- data/spec/higher_level_api/integration/toxiproxy_spec.rb +76 -0
- data/spec/higher_level_api/integration/tx_commit_spec.rb +1 -1
- data/spec/higher_level_api/integration/tx_rollback_spec.rb +1 -1
- data/spec/higher_level_api/integration/with_channel_spec.rb +2 -2
- data/spec/issues/issue100_spec.rb +11 -12
- data/spec/issues/issue141_spec.rb +13 -14
- data/spec/issues/issue202_spec.rb +1 -1
- data/spec/issues/issue224_spec.rb +5 -5
- data/spec/issues/issue465_spec.rb +32 -0
- data/spec/issues/issue549_spec.rb +30 -0
- data/spec/issues/issue78_spec.rb +21 -24
- data/spec/issues/issue83_spec.rb +5 -6
- data/spec/issues/issue97_spec.rb +44 -45
- data/spec/lower_level_api/integration/basic_cancel_spec.rb +15 -16
- data/spec/lower_level_api/integration/basic_consume_spec.rb +20 -21
- data/spec/spec_helper.rb +2 -19
- data/spec/stress/channel_close_stress_spec.rb +3 -3
- data/spec/stress/channel_open_stress_spec.rb +4 -4
- data/spec/stress/channel_open_stress_with_single_threaded_connection_spec.rb +7 -7
- data/spec/stress/concurrent_consumers_stress_spec.rb +18 -16
- data/spec/stress/concurrent_publishers_stress_spec.rb +16 -19
- data/spec/stress/connection_open_close_spec.rb +9 -9
- data/spec/stress/merry_go_round_spec.rb +105 -0
- data/spec/tls/ca_certificate.pem +27 -16
- data/spec/tls/ca_key.pem +52 -27
- data/spec/tls/client_certificate.pem +27 -16
- data/spec/tls/client_key.pem +49 -25
- data/spec/tls/generate-server-cert.sh +8 -0
- data/spec/tls/server-openssl.cnf +10 -0
- data/spec/tls/server.csr +16 -0
- data/spec/tls/server_certificate.pem +27 -16
- data/spec/tls/server_key.pem +49 -25
- data/spec/toxiproxy_helper.rb +28 -0
- data/spec/unit/bunny_spec.rb +5 -5
- data/spec/unit/concurrent/atomic_fixnum_spec.rb +6 -6
- data/spec/unit/concurrent/condition_spec.rb +8 -8
- data/spec/unit/concurrent/linked_continuation_queue_spec.rb +2 -2
- data/spec/unit/concurrent/synchronized_sorted_set_spec.rb +16 -16
- data/spec/unit/exchange_recovery_spec.rb +39 -0
- data/spec/unit/version_delivery_tag_spec.rb +3 -3
- metadata +42 -35
- data/lib/bunny/system_timer.rb +0 -20
- data/spec/config/rabbitmq.config +0 -18
- data/spec/higher_level_api/integration/basic_recover_spec.rb +0 -18
- data/spec/higher_level_api/integration/confirm_select_spec.rb +0 -19
- data/spec/higher_level_api/integration/consistent_hash_exchange_spec.rb +0 -50
- data/spec/higher_level_api/integration/merry_go_round_spec.rb +0 -85
- data/spec/stress/long_running_consumer_spec.rb +0 -83
- data/spec/tls/cacert.pem +0 -18
- data/spec/tls/client_cert.pem +0 -18
- data/spec/tls/server_cert.pem +0 -18
- data/spec/unit/system_timer_spec.rb +0 -10
data/spec/tls/server_key.pem
CHANGED
@@ -1,27 +1,51 @@
|
|
1
1
|
-----BEGIN RSA PRIVATE KEY-----
|
2
|
-
|
3
|
-
|
4
|
-
/
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15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|
+
g+Bo5p6Sv0q5ZdJzY6XPuih0ngtiOoAjFQBjy0wN7rxm5J+yc8kLZ5ZldobYYNQM
|
45
|
+
EF2+B7IGdjnXdy/J1t5A/VFYgB0Fgx5xAoIBACb2w8IJgCaUn2LuK08MXQj/3qMb
|
46
|
+
RtS3sGJtJgHNqiF0QkBN5ELlh6MVM4J/IEGR1X88nxqwkOvy0do+l7wAjM4tF7IS
|
47
|
+
fvsUuL2VzNMnGofRXK+nU+AeixUJLTDd1TKwODr+WAx1UVg+pfwmkDgU6oiHQZSF
|
48
|
+
0+RRBuPEFYHlPBM+fVXnLpAe24knArZFWnqtqNhAPDkUbf2gy5hRYQxnozqzjQ6r
|
49
|
+
OTBWPj2Ja5swnBIxliSzww4r11mu2ld6GFUQOhFIYTmCe/zzbZQdkRw2UP7hSdrf
|
50
|
+
8KOTN1ZHZ1oWU+rKKLmhpFExJsOqIc+dCwEVWLSqUN4Bd8eyo1arHWaG5E4=
|
27
51
|
-----END RSA PRIVATE KEY-----
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module RabbitMQ
|
2
|
+
module Toxiproxy
|
3
|
+
RABBITMQ_UPSTREAM_HOST = if !ENV["LOCAL_RABBITMQ"].nil?
|
4
|
+
# a local Toxiproxy/RabbitMQ combination
|
5
|
+
"localhost"
|
6
|
+
else
|
7
|
+
# docker-compose
|
8
|
+
"rabbitmq"
|
9
|
+
end
|
10
|
+
|
11
|
+
def setup_toxiproxy
|
12
|
+
::Toxiproxy.populate([{
|
13
|
+
name: "rabbitmq",
|
14
|
+
listen: "0.0.0.0:11111",
|
15
|
+
upstream: "#{RABBITMQ_UPSTREAM_HOST}:5672"
|
16
|
+
}])
|
17
|
+
rabbitmq_toxiproxy.enable
|
18
|
+
end
|
19
|
+
|
20
|
+
def cleanup_toxiproxy
|
21
|
+
::Toxiproxy.populate()
|
22
|
+
end
|
23
|
+
|
24
|
+
def rabbitmq_toxiproxy
|
25
|
+
::Toxiproxy[/rabbitmq/]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/spec/unit/bunny_spec.rb
CHANGED
@@ -2,14 +2,14 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe Bunny do
|
4
4
|
it "has library version" do
|
5
|
-
Bunny::VERSION.
|
6
|
-
Bunny.version.
|
5
|
+
expect(Bunny::VERSION).not_to be_nil
|
6
|
+
expect(Bunny.version).not_to be_nil
|
7
7
|
end
|
8
8
|
|
9
9
|
|
10
10
|
it "has AMQP protocol version" do
|
11
|
-
Bunny::PROTOCOL_VERSION.
|
12
|
-
AMQ::Protocol::PROTOCOL_VERSION.
|
13
|
-
Bunny.protocol_version.
|
11
|
+
expect(Bunny::PROTOCOL_VERSION).to eq "0.9.1"
|
12
|
+
expect(AMQ::Protocol::PROTOCOL_VERSION).to eq "0.9.1"
|
13
|
+
expect(Bunny.protocol_version).to eq "0.9.1"
|
14
14
|
end
|
15
15
|
end
|
@@ -5,31 +5,31 @@ describe Bunny::Concurrent::AtomicFixnum do
|
|
5
5
|
it "allows retrieving the current value" do
|
6
6
|
af = described_class.new(0)
|
7
7
|
|
8
|
-
af.get.
|
9
|
-
af.
|
8
|
+
expect(af.get).to eq 0
|
9
|
+
expect(af).to eq 0
|
10
10
|
end
|
11
11
|
|
12
12
|
it "can be updated" do
|
13
13
|
af = described_class.new(0)
|
14
14
|
|
15
|
-
af.get.
|
15
|
+
expect(af.get).to eq 0
|
16
16
|
Thread.new do
|
17
17
|
af.set(10)
|
18
18
|
end
|
19
19
|
sleep 0.6
|
20
|
-
af.get.
|
20
|
+
expect(af.get).to eq 10
|
21
21
|
end
|
22
22
|
|
23
23
|
it "can be incremented" do
|
24
24
|
af = described_class.new(0)
|
25
25
|
|
26
|
-
af.get.
|
26
|
+
expect(af.get).to eq 0
|
27
27
|
10.times do
|
28
28
|
Thread.new do
|
29
29
|
af.increment
|
30
30
|
end
|
31
31
|
end
|
32
32
|
sleep 0.6
|
33
|
-
af.get.
|
33
|
+
expect(af.get).to eq 10
|
34
34
|
end
|
35
35
|
end
|
@@ -4,7 +4,7 @@ require "bunny/concurrent/condition"
|
|
4
4
|
describe Bunny::Concurrent::Condition do
|
5
5
|
|
6
6
|
describe "#wait" do
|
7
|
-
|
7
|
+
50.times do |i|
|
8
8
|
it "blocks current thread until notified (take #{i})" do
|
9
9
|
condition = described_class.new
|
10
10
|
xs = []
|
@@ -12,19 +12,19 @@ describe Bunny::Concurrent::Condition do
|
|
12
12
|
t = Thread.new do
|
13
13
|
xs << :notified
|
14
14
|
|
15
|
-
sleep 0.
|
15
|
+
sleep 0.2
|
16
16
|
condition.notify
|
17
17
|
end
|
18
18
|
t.abort_on_exception = true
|
19
19
|
|
20
20
|
condition.wait
|
21
|
-
xs.
|
21
|
+
expect(xs).to eq [:notified]
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
26
|
describe "#notify" do
|
27
|
-
|
27
|
+
50.times do |i|
|
28
28
|
it "notifies a single thread waiting on the latch (take #{i})" do
|
29
29
|
mutex = Mutex.new
|
30
30
|
condition = described_class.new
|
@@ -42,10 +42,10 @@ describe Bunny::Concurrent::Condition do
|
|
42
42
|
end
|
43
43
|
t2.abort_on_exception = true
|
44
44
|
|
45
|
-
sleep 0.
|
45
|
+
sleep 0.2
|
46
46
|
condition.notify
|
47
47
|
sleep 0.5
|
48
|
-
xs.
|
48
|
+
expect(xs).to satisfy { |ys| ys.size == 1 && (ys.include?(:notified1) || ys.include?(:notified2)) }
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
@@ -53,7 +53,7 @@ describe Bunny::Concurrent::Condition do
|
|
53
53
|
describe "#notify_all" do
|
54
54
|
let(:n) { 30 }
|
55
55
|
|
56
|
-
|
56
|
+
50.times do |i|
|
57
57
|
it "notifies all the threads waiting on the latch (take #{i})" do
|
58
58
|
mutex = Mutex.new
|
59
59
|
condition = described_class.new
|
@@ -74,7 +74,7 @@ describe Bunny::Concurrent::Condition do
|
|
74
74
|
n.times do |i|
|
75
75
|
item = "notified#{i + 1}".to_sym
|
76
76
|
|
77
|
-
@xs.
|
77
|
+
expect(@xs).to include item
|
78
78
|
end
|
79
79
|
end
|
80
80
|
end
|
@@ -14,7 +14,7 @@ if defined?(JRUBY_VERSION)
|
|
14
14
|
t.abort_on_exception = true
|
15
15
|
|
16
16
|
v = subject.poll(500)
|
17
|
-
v.
|
17
|
+
expect(v).to eq 10
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -28,7 +28,7 @@ if defined?(JRUBY_VERSION)
|
|
28
28
|
end
|
29
29
|
t.abort_on_exception = true
|
30
30
|
|
31
|
-
|
31
|
+
expect { subject.poll(500) }.to raise_error(::Timeout::Error)
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
@@ -6,42 +6,42 @@ unless ENV["CI"]
|
|
6
6
|
50.times do |i|
|
7
7
|
it "provides the same API as SortedSet for key operations (take #{i})" do
|
8
8
|
s = described_class.new
|
9
|
-
s.length.
|
9
|
+
expect(s.length).to eq 0
|
10
10
|
|
11
11
|
s << 1
|
12
|
-
s.length.
|
12
|
+
expect(s.length).to eq 1
|
13
13
|
s << 1
|
14
|
-
s.length.
|
14
|
+
expect(s.length).to eq 1
|
15
15
|
s << 2
|
16
|
-
s.length.
|
16
|
+
expect(s.length).to eq 2
|
17
17
|
s << 3
|
18
|
-
s.length.
|
18
|
+
expect(s.length).to eq 3
|
19
19
|
s << 4
|
20
|
-
s.length.
|
20
|
+
expect(s.length).to eq 4
|
21
21
|
s << 4
|
22
22
|
s << 4
|
23
23
|
s << 4
|
24
|
-
s.length.
|
24
|
+
expect(s.length).to eq 4
|
25
25
|
s << 5
|
26
|
-
s.length.
|
26
|
+
expect(s.length).to eq 5
|
27
27
|
s << 5
|
28
28
|
s << 5
|
29
29
|
s << 5
|
30
|
-
s.length.
|
30
|
+
expect(s.length).to eq 5
|
31
31
|
s << 6
|
32
|
-
s.length.
|
32
|
+
expect(s.length).to eq 6
|
33
33
|
s << 7
|
34
|
-
s.length.
|
34
|
+
expect(s.length).to eq 7
|
35
35
|
s << 8
|
36
|
-
s.length.
|
36
|
+
expect(s.length).to eq 8
|
37
37
|
s.delete 8
|
38
|
-
s.length.
|
38
|
+
expect(s.length).to eq 7
|
39
39
|
s.delete_if { |i| i == 1 }
|
40
|
-
s.length.
|
40
|
+
expect(s.length).to eq 6
|
41
41
|
end
|
42
42
|
it "synchronizes common operations needed by Bunny (take #{i})" do
|
43
43
|
s = described_class.new
|
44
|
-
s.length.
|
44
|
+
expect(s.length).to eq 0
|
45
45
|
|
46
46
|
10.times do
|
47
47
|
Thread.new do
|
@@ -66,7 +66,7 @@ unless ENV["CI"]
|
|
66
66
|
end
|
67
67
|
sleep 0.5
|
68
68
|
|
69
|
-
s.length.
|
69
|
+
expect(s.length).to eq 6
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'bunny/channel'
|
2
|
+
require 'bunny/exchange'
|
3
|
+
|
4
|
+
module Bunny
|
5
|
+
describe Exchange do
|
6
|
+
context "recovery" do
|
7
|
+
it "recovers exchange bindings, unless already unbound" do
|
8
|
+
ch = instance_double(Bunny::Channel,
|
9
|
+
exchange_declare: nil,
|
10
|
+
register_exchange: nil)
|
11
|
+
src1 = Exchange.new(ch, "direct", "src1")
|
12
|
+
src2 = Exchange.new(ch, "direct", "src2")
|
13
|
+
src3 = Exchange.new(ch, "direct", "src3")
|
14
|
+
dst = Exchange.new(ch, "direct", "dst")
|
15
|
+
|
16
|
+
original_binds_count = 5
|
17
|
+
expected_rebinds_count = 3
|
18
|
+
expected_total_binds = original_binds_count + expected_rebinds_count
|
19
|
+
allow(ch).to receive(:exchange_bind).exactly(expected_total_binds).times
|
20
|
+
|
21
|
+
dst.bind(src1, routing_key: "abc")
|
22
|
+
dst.bind(src2, routing_key: "def")
|
23
|
+
dst.bind(src2, routing_key: "ghi")
|
24
|
+
dst.bind(src3, routing_key: "jkl")
|
25
|
+
dst.bind(src3, routing_key: "jkl", arguments: {"key" => "value"})
|
26
|
+
|
27
|
+
allow(ch).to receive(:exchange_unbind).twice
|
28
|
+
dst.unbind(src2, routing_key: "def")
|
29
|
+
dst.unbind(src3, routing_key: "jkl", arguments: {"key" => "value"})
|
30
|
+
|
31
|
+
expect(ch).to receive(:exchange_bind).with(src1, dst, routing_key: "abc")
|
32
|
+
expect(ch).to receive(:exchange_bind).with(src2, dst, routing_key: "ghi")
|
33
|
+
expect(ch).to receive(:exchange_bind).with(src3, dst, routing_key: "jkl")
|
34
|
+
|
35
|
+
dst.recover_from_network_failure
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -8,13 +8,13 @@ describe Bunny::VersionedDeliveryTag, "#stale?" do
|
|
8
8
|
|
9
9
|
context "when delivery tag version < provided version" do
|
10
10
|
it "returns true" do
|
11
|
-
subject.stale?(2).
|
11
|
+
expect(subject.stale?(2)).to eq true
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
context "when delivery tag version = provided version" do
|
16
16
|
it "returns false" do
|
17
|
-
subject.stale?(1).
|
17
|
+
expect(subject.stale?(1)).to eq false
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -22,7 +22,7 @@ describe Bunny::VersionedDeliveryTag, "#stale?" do
|
|
22
22
|
it "returns true" do
|
23
23
|
# this scenario is unrealistic but we still can
|
24
24
|
# unit test it. MK.
|
25
|
-
subject.stale?(0).
|
25
|
+
expect(subject.stale?(0)).to eq false
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bunny
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Duncan
|
@@ -12,43 +12,48 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2020-09-11 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: amq-protocol
|
19
19
|
requirement: !ruby/object:Gem::Requirement
|
20
20
|
requirements:
|
21
|
+
- - "~>"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '2.3'
|
21
24
|
- - ">="
|
22
25
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
26
|
+
version: 2.3.1
|
24
27
|
type: :runtime
|
25
28
|
prerelease: false
|
26
29
|
version_requirements: !ruby/object:Gem::Requirement
|
27
30
|
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.3'
|
28
34
|
- - ">="
|
29
35
|
- !ruby/object:Gem::Version
|
30
|
-
version:
|
36
|
+
version: 2.3.1
|
31
37
|
description: Easy to use, feature complete Ruby client for RabbitMQ 3.3 and later
|
32
38
|
versions.
|
33
39
|
email:
|
34
|
-
-
|
35
|
-
- eric@5stops.com
|
36
|
-
- stastny@101ideas.cz
|
37
|
-
- michael@novemberain.com
|
38
|
-
- skaes@railsexpress.de
|
40
|
+
- michael.s.klishin@gmail.com
|
39
41
|
executables: []
|
40
42
|
extensions: []
|
41
43
|
extra_rdoc_files:
|
42
44
|
- README.md
|
43
45
|
files:
|
46
|
+
- ".github/ISSUE_TEMPLATE.md"
|
44
47
|
- ".gitignore"
|
45
48
|
- ".rspec"
|
46
49
|
- ".travis.yml"
|
47
50
|
- ".yardopts"
|
51
|
+
- CONTRIBUTING.md
|
48
52
|
- ChangeLog.md
|
49
53
|
- Gemfile
|
50
54
|
- LICENSE
|
51
55
|
- README.md
|
56
|
+
- Rakefile
|
52
57
|
- benchmarks/basic_publish/with_128K_messages.rb
|
53
58
|
- benchmarks/basic_publish/with_1k_messages.rb
|
54
59
|
- benchmarks/basic_publish/with_4K_messages.rb
|
@@ -60,8 +65,13 @@ files:
|
|
60
65
|
- benchmarks/queue_declare_bind_and_delete.rb
|
61
66
|
- benchmarks/synchronized_sorted_set.rb
|
62
67
|
- benchmarks/write_vs_write_nonblock.rb
|
63
|
-
- bin/ci/before_build
|
64
68
|
- bunny.gemspec
|
69
|
+
- docker-compose.yml
|
70
|
+
- docker/Dockerfile
|
71
|
+
- docker/apt/preferences.d/erlang
|
72
|
+
- docker/apt/sources.list.d/bintray.rabbitmq.list
|
73
|
+
- docker/docker-entrypoint.sh
|
74
|
+
- docker/rabbitmq.conf
|
65
75
|
- examples/connection/authentication_failure.rb
|
66
76
|
- examples/connection/automatic_recovery_with_basic_get.rb
|
67
77
|
- examples/connection/automatic_recovery_with_client_named_queues.rb
|
@@ -127,7 +137,6 @@ files:
|
|
127
137
|
- lib/bunny/session.rb
|
128
138
|
- lib/bunny/socket.rb
|
129
139
|
- lib/bunny/ssl_socket.rb
|
130
|
-
- lib/bunny/system_timer.rb
|
131
140
|
- lib/bunny/test_kit.rb
|
132
141
|
- lib/bunny/timeout.rb
|
133
142
|
- lib/bunny/transport.rb
|
@@ -136,7 +145,7 @@ files:
|
|
136
145
|
- profiling/basic_publish/with_4K_messages.rb
|
137
146
|
- repl
|
138
147
|
- spec/config/enabled_plugins
|
139
|
-
- spec/config/rabbitmq.
|
148
|
+
- spec/config/rabbitmq.conf
|
140
149
|
- spec/higher_level_api/integration/basic_ack_spec.rb
|
141
150
|
- spec/higher_level_api/integration/basic_cancel_spec.rb
|
142
151
|
- spec/higher_level_api/integration/basic_consume_spec.rb
|
@@ -145,16 +154,13 @@ files:
|
|
145
154
|
- spec/higher_level_api/integration/basic_nack_spec.rb
|
146
155
|
- spec/higher_level_api/integration/basic_publish_spec.rb
|
147
156
|
- spec/higher_level_api/integration/basic_qos_spec.rb
|
148
|
-
- spec/higher_level_api/integration/basic_recover_spec.rb
|
149
157
|
- spec/higher_level_api/integration/basic_reject_spec.rb
|
150
158
|
- spec/higher_level_api/integration/basic_return_spec.rb
|
151
159
|
- spec/higher_level_api/integration/channel_close_spec.rb
|
152
160
|
- spec/higher_level_api/integration/channel_open_spec.rb
|
153
|
-
- spec/higher_level_api/integration/confirm_select_spec.rb
|
154
161
|
- spec/higher_level_api/integration/connection_recovery_spec.rb
|
155
162
|
- spec/higher_level_api/integration/connection_spec.rb
|
156
163
|
- spec/higher_level_api/integration/connection_stop_spec.rb
|
157
|
-
- spec/higher_level_api/integration/consistent_hash_exchange_spec.rb
|
158
164
|
- spec/higher_level_api/integration/consumer_cancellation_notification_spec.rb
|
159
165
|
- spec/higher_level_api/integration/dead_lettering_spec.rb
|
160
166
|
- spec/higher_level_api/integration/exchange_bind_spec.rb
|
@@ -163,7 +169,6 @@ files:
|
|
163
169
|
- spec/higher_level_api/integration/exchange_unbind_spec.rb
|
164
170
|
- spec/higher_level_api/integration/exclusive_queue_spec.rb
|
165
171
|
- spec/higher_level_api/integration/heartbeat_spec.rb
|
166
|
-
- spec/higher_level_api/integration/merry_go_round_spec.rb
|
167
172
|
- spec/higher_level_api/integration/message_properties_access_spec.rb
|
168
173
|
- spec/higher_level_api/integration/predeclared_exchanges_spec.rb
|
169
174
|
- spec/higher_level_api/integration/publisher_confirms_spec.rb
|
@@ -176,6 +181,7 @@ files:
|
|
176
181
|
- spec/higher_level_api/integration/read_only_consumer_spec.rb
|
177
182
|
- spec/higher_level_api/integration/sender_selected_distribution_spec.rb
|
178
183
|
- spec/higher_level_api/integration/tls_connection_spec.rb
|
184
|
+
- spec/higher_level_api/integration/toxiproxy_spec.rb
|
179
185
|
- spec/higher_level_api/integration/tx_commit_spec.rb
|
180
186
|
- spec/higher_level_api/integration/tx_rollback_spec.rb
|
181
187
|
- spec/higher_level_api/integration/with_channel_spec.rb
|
@@ -183,6 +189,8 @@ files:
|
|
183
189
|
- spec/issues/issue141_spec.rb
|
184
190
|
- spec/issues/issue202_spec.rb
|
185
191
|
- spec/issues/issue224_spec.rb
|
192
|
+
- spec/issues/issue465_spec.rb
|
193
|
+
- spec/issues/issue549_spec.rb
|
186
194
|
- spec/issues/issue78_spec.rb
|
187
195
|
- spec/issues/issue83_spec.rb
|
188
196
|
- spec/issues/issue97_attachment.json
|
@@ -196,22 +204,23 @@ files:
|
|
196
204
|
- spec/stress/concurrent_consumers_stress_spec.rb
|
197
205
|
- spec/stress/concurrent_publishers_stress_spec.rb
|
198
206
|
- spec/stress/connection_open_close_spec.rb
|
199
|
-
- spec/stress/
|
207
|
+
- spec/stress/merry_go_round_spec.rb
|
200
208
|
- spec/tls/ca_certificate.pem
|
201
209
|
- spec/tls/ca_key.pem
|
202
|
-
- spec/tls/cacert.pem
|
203
|
-
- spec/tls/client_cert.pem
|
204
210
|
- spec/tls/client_certificate.pem
|
205
211
|
- spec/tls/client_key.pem
|
206
|
-
- spec/tls/
|
212
|
+
- spec/tls/generate-server-cert.sh
|
213
|
+
- spec/tls/server-openssl.cnf
|
214
|
+
- spec/tls/server.csr
|
207
215
|
- spec/tls/server_certificate.pem
|
208
216
|
- spec/tls/server_key.pem
|
217
|
+
- spec/toxiproxy_helper.rb
|
209
218
|
- spec/unit/bunny_spec.rb
|
210
219
|
- spec/unit/concurrent/atomic_fixnum_spec.rb
|
211
220
|
- spec/unit/concurrent/condition_spec.rb
|
212
221
|
- spec/unit/concurrent/linked_continuation_queue_spec.rb
|
213
222
|
- spec/unit/concurrent/synchronized_sorted_set_spec.rb
|
214
|
-
- spec/unit/
|
223
|
+
- spec/unit/exchange_recovery_spec.rb
|
215
224
|
- spec/unit/version_delivery_tag_spec.rb
|
216
225
|
homepage: http://rubybunny.info
|
217
226
|
licenses:
|
@@ -225,21 +234,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
225
234
|
requirements:
|
226
235
|
- - ">="
|
227
236
|
- !ruby/object:Gem::Version
|
228
|
-
version: '
|
237
|
+
version: '2.2'
|
229
238
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
230
239
|
requirements:
|
231
240
|
- - ">="
|
232
241
|
- !ruby/object:Gem::Version
|
233
242
|
version: '0'
|
234
243
|
requirements: []
|
235
|
-
|
236
|
-
rubygems_version: 2.4.5
|
244
|
+
rubygems_version: 3.1.2
|
237
245
|
signing_key:
|
238
246
|
specification_version: 4
|
239
247
|
summary: Popular easy to use Ruby client for RabbitMQ
|
240
248
|
test_files:
|
241
249
|
- spec/config/enabled_plugins
|
242
|
-
- spec/config/rabbitmq.
|
250
|
+
- spec/config/rabbitmq.conf
|
243
251
|
- spec/higher_level_api/integration/basic_ack_spec.rb
|
244
252
|
- spec/higher_level_api/integration/basic_cancel_spec.rb
|
245
253
|
- spec/higher_level_api/integration/basic_consume_spec.rb
|
@@ -248,16 +256,13 @@ test_files:
|
|
248
256
|
- spec/higher_level_api/integration/basic_nack_spec.rb
|
249
257
|
- spec/higher_level_api/integration/basic_publish_spec.rb
|
250
258
|
- spec/higher_level_api/integration/basic_qos_spec.rb
|
251
|
-
- spec/higher_level_api/integration/basic_recover_spec.rb
|
252
259
|
- spec/higher_level_api/integration/basic_reject_spec.rb
|
253
260
|
- spec/higher_level_api/integration/basic_return_spec.rb
|
254
261
|
- spec/higher_level_api/integration/channel_close_spec.rb
|
255
262
|
- spec/higher_level_api/integration/channel_open_spec.rb
|
256
|
-
- spec/higher_level_api/integration/confirm_select_spec.rb
|
257
263
|
- spec/higher_level_api/integration/connection_recovery_spec.rb
|
258
264
|
- spec/higher_level_api/integration/connection_spec.rb
|
259
265
|
- spec/higher_level_api/integration/connection_stop_spec.rb
|
260
|
-
- spec/higher_level_api/integration/consistent_hash_exchange_spec.rb
|
261
266
|
- spec/higher_level_api/integration/consumer_cancellation_notification_spec.rb
|
262
267
|
- spec/higher_level_api/integration/dead_lettering_spec.rb
|
263
268
|
- spec/higher_level_api/integration/exchange_bind_spec.rb
|
@@ -266,7 +271,6 @@ test_files:
|
|
266
271
|
- spec/higher_level_api/integration/exchange_unbind_spec.rb
|
267
272
|
- spec/higher_level_api/integration/exclusive_queue_spec.rb
|
268
273
|
- spec/higher_level_api/integration/heartbeat_spec.rb
|
269
|
-
- spec/higher_level_api/integration/merry_go_round_spec.rb
|
270
274
|
- spec/higher_level_api/integration/message_properties_access_spec.rb
|
271
275
|
- spec/higher_level_api/integration/predeclared_exchanges_spec.rb
|
272
276
|
- spec/higher_level_api/integration/publisher_confirms_spec.rb
|
@@ -279,6 +283,7 @@ test_files:
|
|
279
283
|
- spec/higher_level_api/integration/read_only_consumer_spec.rb
|
280
284
|
- spec/higher_level_api/integration/sender_selected_distribution_spec.rb
|
281
285
|
- spec/higher_level_api/integration/tls_connection_spec.rb
|
286
|
+
- spec/higher_level_api/integration/toxiproxy_spec.rb
|
282
287
|
- spec/higher_level_api/integration/tx_commit_spec.rb
|
283
288
|
- spec/higher_level_api/integration/tx_rollback_spec.rb
|
284
289
|
- spec/higher_level_api/integration/with_channel_spec.rb
|
@@ -286,6 +291,8 @@ test_files:
|
|
286
291
|
- spec/issues/issue141_spec.rb
|
287
292
|
- spec/issues/issue202_spec.rb
|
288
293
|
- spec/issues/issue224_spec.rb
|
294
|
+
- spec/issues/issue465_spec.rb
|
295
|
+
- spec/issues/issue549_spec.rb
|
289
296
|
- spec/issues/issue78_spec.rb
|
290
297
|
- spec/issues/issue83_spec.rb
|
291
298
|
- spec/issues/issue97_attachment.json
|
@@ -299,21 +306,21 @@ test_files:
|
|
299
306
|
- spec/stress/concurrent_consumers_stress_spec.rb
|
300
307
|
- spec/stress/concurrent_publishers_stress_spec.rb
|
301
308
|
- spec/stress/connection_open_close_spec.rb
|
302
|
-
- spec/stress/
|
309
|
+
- spec/stress/merry_go_round_spec.rb
|
303
310
|
- spec/tls/ca_certificate.pem
|
304
311
|
- spec/tls/ca_key.pem
|
305
|
-
- spec/tls/cacert.pem
|
306
|
-
- spec/tls/client_cert.pem
|
307
312
|
- spec/tls/client_certificate.pem
|
308
313
|
- spec/tls/client_key.pem
|
309
|
-
- spec/tls/
|
314
|
+
- spec/tls/generate-server-cert.sh
|
315
|
+
- spec/tls/server-openssl.cnf
|
316
|
+
- spec/tls/server.csr
|
310
317
|
- spec/tls/server_certificate.pem
|
311
318
|
- spec/tls/server_key.pem
|
319
|
+
- spec/toxiproxy_helper.rb
|
312
320
|
- spec/unit/bunny_spec.rb
|
313
321
|
- spec/unit/concurrent/atomic_fixnum_spec.rb
|
314
322
|
- spec/unit/concurrent/condition_spec.rb
|
315
323
|
- spec/unit/concurrent/linked_continuation_queue_spec.rb
|
316
324
|
- spec/unit/concurrent/synchronized_sorted_set_spec.rb
|
317
|
-
- spec/unit/
|
325
|
+
- spec/unit/exchange_recovery_spec.rb
|
318
326
|
- spec/unit/version_delivery_tag_spec.rb
|
319
|
-
has_rdoc: true
|