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.
Files changed (141) hide show
  1. checksums.yaml +5 -5
  2. data/.github/ISSUE_TEMPLATE.md +18 -0
  3. data/.gitignore +6 -1
  4. data/.rspec +1 -3
  5. data/.travis.yml +21 -14
  6. data/CONTRIBUTING.md +132 -0
  7. data/ChangeLog.md +745 -1
  8. data/Gemfile +13 -13
  9. data/LICENSE +1 -1
  10. data/README.md +41 -75
  11. data/Rakefile +54 -0
  12. data/bunny.gemspec +4 -10
  13. data/docker-compose.yml +28 -0
  14. data/docker/Dockerfile +24 -0
  15. data/docker/apt/preferences.d/erlang +3 -0
  16. data/docker/apt/sources.list.d/bintray.rabbitmq.list +2 -0
  17. data/docker/docker-entrypoint.sh +26 -0
  18. data/docker/rabbitmq.conf +29 -0
  19. data/examples/connection/automatic_recovery_with_basic_get.rb +1 -1
  20. data/examples/connection/automatic_recovery_with_client_named_queues.rb +1 -1
  21. data/examples/connection/automatic_recovery_with_multiple_consumers.rb +1 -1
  22. data/examples/connection/automatic_recovery_with_republishing.rb +1 -1
  23. data/examples/connection/automatic_recovery_with_server_named_queues.rb +1 -1
  24. data/examples/connection/channel_level_exception.rb +1 -9
  25. data/examples/connection/disabled_automatic_recovery.rb +1 -1
  26. data/examples/connection/heartbeat.rb +1 -1
  27. data/examples/consumers/high_and_low_priority.rb +1 -1
  28. data/examples/guides/extensions/alternate_exchange.rb +2 -0
  29. data/examples/guides/getting_started/hello_world.rb +2 -0
  30. data/examples/guides/getting_started/weathr.rb +2 -0
  31. data/examples/guides/queues/one_off_consumer.rb +2 -0
  32. data/examples/guides/queues/redeliveries.rb +2 -0
  33. data/lib/bunny.rb +6 -2
  34. data/lib/bunny/channel.rb +192 -109
  35. data/lib/bunny/channel_id_allocator.rb +6 -4
  36. data/lib/bunny/concurrent/continuation_queue.rb +34 -13
  37. data/lib/bunny/consumer_work_pool.rb +34 -6
  38. data/lib/bunny/cruby/socket.rb +29 -16
  39. data/lib/bunny/cruby/ssl_socket.rb +20 -7
  40. data/lib/bunny/exceptions.rb +7 -1
  41. data/lib/bunny/exchange.rb +11 -7
  42. data/lib/bunny/get_response.rb +1 -1
  43. data/lib/bunny/heartbeat_sender.rb +3 -2
  44. data/lib/bunny/jruby/socket.rb +23 -6
  45. data/lib/bunny/jruby/ssl_socket.rb +5 -0
  46. data/lib/bunny/queue.rb +12 -10
  47. data/lib/bunny/reader_loop.rb +31 -18
  48. data/lib/bunny/session.rb +389 -134
  49. data/lib/bunny/test_kit.rb +14 -0
  50. data/lib/bunny/timeout.rb +1 -12
  51. data/lib/bunny/transport.rb +114 -67
  52. data/lib/bunny/version.rb +1 -1
  53. data/repl +1 -1
  54. data/spec/config/rabbitmq.conf +13 -0
  55. data/spec/higher_level_api/integration/basic_ack_spec.rb +154 -22
  56. data/spec/higher_level_api/integration/basic_cancel_spec.rb +77 -11
  57. data/spec/higher_level_api/integration/basic_consume_spec.rb +60 -55
  58. data/spec/higher_level_api/integration/basic_consume_with_objects_spec.rb +6 -6
  59. data/spec/higher_level_api/integration/basic_get_spec.rb +31 -7
  60. data/spec/higher_level_api/integration/basic_nack_spec.rb +22 -19
  61. data/spec/higher_level_api/integration/basic_publish_spec.rb +11 -100
  62. data/spec/higher_level_api/integration/basic_qos_spec.rb +32 -4
  63. data/spec/higher_level_api/integration/basic_reject_spec.rb +94 -16
  64. data/spec/higher_level_api/integration/basic_return_spec.rb +4 -4
  65. data/spec/higher_level_api/integration/channel_close_spec.rb +51 -10
  66. data/spec/higher_level_api/integration/channel_open_spec.rb +12 -12
  67. data/spec/higher_level_api/integration/connection_recovery_spec.rb +412 -286
  68. data/spec/higher_level_api/integration/connection_spec.rb +284 -134
  69. data/spec/higher_level_api/integration/connection_stop_spec.rb +31 -19
  70. data/spec/higher_level_api/integration/consumer_cancellation_notification_spec.rb +17 -17
  71. data/spec/higher_level_api/integration/dead_lettering_spec.rb +14 -14
  72. data/spec/higher_level_api/integration/exchange_bind_spec.rb +5 -5
  73. data/spec/higher_level_api/integration/exchange_declare_spec.rb +32 -31
  74. data/spec/higher_level_api/integration/exchange_delete_spec.rb +12 -12
  75. data/spec/higher_level_api/integration/exchange_unbind_spec.rb +5 -5
  76. data/spec/higher_level_api/integration/exclusive_queue_spec.rb +5 -5
  77. data/spec/higher_level_api/integration/heartbeat_spec.rb +4 -4
  78. data/spec/higher_level_api/integration/message_properties_access_spec.rb +49 -49
  79. data/spec/higher_level_api/integration/predeclared_exchanges_spec.rb +2 -2
  80. data/spec/higher_level_api/integration/publisher_confirms_spec.rb +92 -27
  81. data/spec/higher_level_api/integration/publishing_edge_cases_spec.rb +19 -19
  82. data/spec/higher_level_api/integration/queue_bind_spec.rb +23 -23
  83. data/spec/higher_level_api/integration/queue_declare_spec.rb +129 -34
  84. data/spec/higher_level_api/integration/queue_delete_spec.rb +2 -2
  85. data/spec/higher_level_api/integration/queue_purge_spec.rb +5 -5
  86. data/spec/higher_level_api/integration/queue_unbind_spec.rb +6 -6
  87. data/spec/higher_level_api/integration/read_only_consumer_spec.rb +9 -9
  88. data/spec/higher_level_api/integration/sender_selected_distribution_spec.rb +10 -10
  89. data/spec/higher_level_api/integration/tls_connection_spec.rb +218 -112
  90. data/spec/higher_level_api/integration/toxiproxy_spec.rb +76 -0
  91. data/spec/higher_level_api/integration/tx_commit_spec.rb +1 -1
  92. data/spec/higher_level_api/integration/tx_rollback_spec.rb +1 -1
  93. data/spec/higher_level_api/integration/with_channel_spec.rb +2 -2
  94. data/spec/issues/issue100_spec.rb +11 -12
  95. data/spec/issues/issue141_spec.rb +13 -14
  96. data/spec/issues/issue202_spec.rb +1 -1
  97. data/spec/issues/issue224_spec.rb +5 -5
  98. data/spec/issues/issue465_spec.rb +32 -0
  99. data/spec/issues/issue549_spec.rb +30 -0
  100. data/spec/issues/issue78_spec.rb +21 -24
  101. data/spec/issues/issue83_spec.rb +5 -6
  102. data/spec/issues/issue97_spec.rb +44 -45
  103. data/spec/lower_level_api/integration/basic_cancel_spec.rb +15 -16
  104. data/spec/lower_level_api/integration/basic_consume_spec.rb +20 -21
  105. data/spec/spec_helper.rb +2 -19
  106. data/spec/stress/channel_close_stress_spec.rb +3 -3
  107. data/spec/stress/channel_open_stress_spec.rb +4 -4
  108. data/spec/stress/channel_open_stress_with_single_threaded_connection_spec.rb +7 -7
  109. data/spec/stress/concurrent_consumers_stress_spec.rb +18 -16
  110. data/spec/stress/concurrent_publishers_stress_spec.rb +16 -19
  111. data/spec/stress/connection_open_close_spec.rb +9 -9
  112. data/spec/stress/merry_go_round_spec.rb +105 -0
  113. data/spec/tls/ca_certificate.pem +27 -16
  114. data/spec/tls/ca_key.pem +52 -27
  115. data/spec/tls/client_certificate.pem +27 -16
  116. data/spec/tls/client_key.pem +49 -25
  117. data/spec/tls/generate-server-cert.sh +8 -0
  118. data/spec/tls/server-openssl.cnf +10 -0
  119. data/spec/tls/server.csr +16 -0
  120. data/spec/tls/server_certificate.pem +27 -16
  121. data/spec/tls/server_key.pem +49 -25
  122. data/spec/toxiproxy_helper.rb +28 -0
  123. data/spec/unit/bunny_spec.rb +5 -5
  124. data/spec/unit/concurrent/atomic_fixnum_spec.rb +6 -6
  125. data/spec/unit/concurrent/condition_spec.rb +8 -8
  126. data/spec/unit/concurrent/linked_continuation_queue_spec.rb +2 -2
  127. data/spec/unit/concurrent/synchronized_sorted_set_spec.rb +16 -16
  128. data/spec/unit/exchange_recovery_spec.rb +39 -0
  129. data/spec/unit/version_delivery_tag_spec.rb +3 -3
  130. metadata +42 -35
  131. data/lib/bunny/system_timer.rb +0 -20
  132. data/spec/config/rabbitmq.config +0 -18
  133. data/spec/higher_level_api/integration/basic_recover_spec.rb +0 -18
  134. data/spec/higher_level_api/integration/confirm_select_spec.rb +0 -19
  135. data/spec/higher_level_api/integration/consistent_hash_exchange_spec.rb +0 -50
  136. data/spec/higher_level_api/integration/merry_go_round_spec.rb +0 -85
  137. data/spec/stress/long_running_consumer_spec.rb +0 -83
  138. data/spec/tls/cacert.pem +0 -18
  139. data/spec/tls/client_cert.pem +0 -18
  140. data/spec/tls/server_cert.pem +0 -18
  141. data/spec/unit/system_timer_spec.rb +0 -10
@@ -1,27 +1,51 @@
1
1
  -----BEGIN RSA PRIVATE KEY-----
2
- MIIEowIBAAKCAQEAu9Bfo/tPPSw0o2DKIRvvWCDziDI5ppOchuA8odMn2QUwtkVD
3
- cc3Tl0cvCofWeh59q5XodU8RJVV/TWY+HbyOt720Gis8BqIjO5/aQqWlmiU3tD13
4
- /mtvZXDd1SmhkmgPhov67xyCGaTOh1W+2zVZEhGMf/JNRzbrr6Hqb2UiL0v0EJgx
5
- MBY4XQoehcDZWAsuRA2/7YYocU/fZkfW9dr3x/ESukn//eNHA/mbi3Q8NI+UDD75
6
- s6LCBlvyv68Q4LJkTXkGi6RKLyu2Jty1KlixvK9Zqh78lB8Y8jdK3zgOGtQ8+bYV
7
- QzJYx5OaV1x/IsDbn+9A+FrgkLh/gFwJi/MJVQIDAQABAoIBAHwiOVR04eaYtSHW
8
- 80H26Lbi8JNwPtJudeJfizOaEJhL6epO1Uj+tX8jOWBIb+W/CWjDaCVA4SA/5igO
9
- D7gvzFR9OfCh6sanm4npGaU7Pr0nJC4pAopSEAqIEta08WmHBdvz4SLxQLwaRbcF
10
- YWQZWomqt6ZJS/JpxlULO5vsyC9hbY0qro7yvZp/wPOITEx/jfINcPavzLlRmc2H
11
- uWGKowCx1lR7iATHovMjVX1LGGj3ACBb98kSsQo25FxVy4N/alWEMIbJZlu8XN6E
12
- rFMTHLAeijh2fxOuZroxglPfEtIinDDqXk897i1qOk3DaSM/B/U4LCtf5RzIq+M+
13
- WeM/EnECgYEA678lzAX82yn+6uHAdTGph+TVPIlk0YmqfyQFDarFpE4aQf80mtB5
14
- RmMpdxdp3smj//cdtJm7pLJpQSWXnSP7k94cbEU+50Lu/fYRf8hYM0kfHlYlt8wA
15
- ktVENpRYk3n+ZgH3088rirL3Ocsjps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
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
@@ -2,14 +2,14 @@ require "spec_helper"
2
2
 
3
3
  describe Bunny do
4
4
  it "has library version" do
5
- Bunny::VERSION.should_not be_nil
6
- Bunny.version.should_not be_nil
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.should == "0.9.1"
12
- AMQ::Protocol::PROTOCOL_VERSION.should == "0.9.1"
13
- Bunny.protocol_version.should == "0.9.1"
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.should == 0
9
- af.should == 0
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.should == 0
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.should == 10
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.should == 0
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.should == 10
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
- 100.times do |i|
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.25
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.should == [:notified]
21
+ expect(xs).to eq [:notified]
22
22
  end
23
23
  end
24
24
  end
25
25
 
26
26
  describe "#notify" do
27
- 100.times do |i|
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.25
45
+ sleep 0.2
46
46
  condition.notify
47
47
  sleep 0.5
48
- xs.should satisfy { |ys| ys.size == 1 && (ys.include?(:notified1) || ys.include?(:notified2)) }
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
- 100.times do |i|
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.should include(item)
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.should == 10
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
- lambda { subject.poll(500) }.should raise_error(::Timeout::Error)
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.should == 0
9
+ expect(s.length).to eq 0
10
10
 
11
11
  s << 1
12
- s.length.should == 1
12
+ expect(s.length).to eq 1
13
13
  s << 1
14
- s.length.should == 1
14
+ expect(s.length).to eq 1
15
15
  s << 2
16
- s.length.should == 2
16
+ expect(s.length).to eq 2
17
17
  s << 3
18
- s.length.should == 3
18
+ expect(s.length).to eq 3
19
19
  s << 4
20
- s.length.should == 4
20
+ expect(s.length).to eq 4
21
21
  s << 4
22
22
  s << 4
23
23
  s << 4
24
- s.length.should == 4
24
+ expect(s.length).to eq 4
25
25
  s << 5
26
- s.length.should == 5
26
+ expect(s.length).to eq 5
27
27
  s << 5
28
28
  s << 5
29
29
  s << 5
30
- s.length.should == 5
30
+ expect(s.length).to eq 5
31
31
  s << 6
32
- s.length.should == 6
32
+ expect(s.length).to eq 6
33
33
  s << 7
34
- s.length.should == 7
34
+ expect(s.length).to eq 7
35
35
  s << 8
36
- s.length.should == 8
36
+ expect(s.length).to eq 8
37
37
  s.delete 8
38
- s.length.should == 7
38
+ expect(s.length).to eq 7
39
39
  s.delete_if { |i| i == 1 }
40
- s.length.should == 6
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.should == 0
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.should == 6
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).should be_true
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).should be_false
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).should be_false
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: 1.7.0
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: 2015-02-05 00:00:00.000000000 Z
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: 1.9.2
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: 1.9.2
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
- - celldee@gmail.com
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.config
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/long_running_consumer_spec.rb
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/server_cert.pem
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/system_timer_spec.rb
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: '0'
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
- rubyforge_project:
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.config
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/long_running_consumer_spec.rb
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/server_cert.pem
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/system_timer_spec.rb
325
+ - spec/unit/exchange_recovery_spec.rb
318
326
  - spec/unit/version_delivery_tag_spec.rb
319
- has_rdoc: true