bunny 2.17.0 → 2.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/lib/bunny/session.rb +22 -4
  4. data/lib/bunny/transport.rb +7 -6
  5. data/lib/bunny/version.rb +1 -1
  6. data/spec/higher_level_api/integration/basic_consume_spec.rb +14 -6
  7. data/spec/higher_level_api/integration/tls_connection_spec.rb +25 -32
  8. data/spec/issues/issue609_spec.rb +84 -0
  9. data/spec/lower_level_api/integration/basic_cancel_spec.rb +1 -1
  10. data/spec/lower_level_api/integration/basic_consume_spec.rb +8 -8
  11. metadata +28 -87
  12. data/.github/ISSUE_TEMPLATE.md +0 -18
  13. data/.gitignore +0 -28
  14. data/.rspec +0 -1
  15. data/.travis.yml +0 -33
  16. data/.yardopts +0 -8
  17. data/CONTRIBUTING.md +0 -132
  18. data/ChangeLog.md +0 -2129
  19. data/Gemfile +0 -55
  20. data/LICENSE +0 -21
  21. data/Rakefile +0 -54
  22. data/benchmarks/basic_publish/with_128K_messages.rb +0 -35
  23. data/benchmarks/basic_publish/with_1k_messages.rb +0 -35
  24. data/benchmarks/basic_publish/with_4K_messages.rb +0 -35
  25. data/benchmarks/basic_publish/with_64K_messages.rb +0 -35
  26. data/benchmarks/channel_open.rb +0 -28
  27. data/benchmarks/mutex_and_monitor.rb +0 -42
  28. data/benchmarks/queue_declare.rb +0 -29
  29. data/benchmarks/queue_declare_and_bind.rb +0 -29
  30. data/benchmarks/queue_declare_bind_and_delete.rb +0 -29
  31. data/benchmarks/synchronized_sorted_set.rb +0 -53
  32. data/benchmarks/write_vs_write_nonblock.rb +0 -49
  33. data/bunny.gemspec +0 -34
  34. data/docker-compose.yml +0 -28
  35. data/docker/Dockerfile +0 -24
  36. data/docker/apt/preferences.d/erlang +0 -3
  37. data/docker/apt/sources.list.d/bintray.rabbitmq.list +0 -2
  38. data/docker/docker-entrypoint.sh +0 -26
  39. data/docker/rabbitmq.conf +0 -29
  40. data/examples/connection/authentication_failure.rb +0 -16
  41. data/examples/connection/automatic_recovery_with_basic_get.rb +0 -40
  42. data/examples/connection/automatic_recovery_with_client_named_queues.rb +0 -36
  43. data/examples/connection/automatic_recovery_with_multiple_consumers.rb +0 -46
  44. data/examples/connection/automatic_recovery_with_republishing.rb +0 -109
  45. data/examples/connection/automatic_recovery_with_server_named_queues.rb +0 -35
  46. data/examples/connection/channel_level_exception.rb +0 -27
  47. data/examples/connection/disabled_automatic_recovery.rb +0 -34
  48. data/examples/connection/heartbeat.rb +0 -17
  49. data/examples/connection/manually_reconnecting_consumer.rb +0 -23
  50. data/examples/connection/manually_reconnecting_publisher.rb +0 -28
  51. data/examples/connection/unknown_host.rb +0 -16
  52. data/examples/consumers/high_and_low_priority.rb +0 -50
  53. data/examples/guides/exchanges/direct_exchange_routing.rb +0 -36
  54. data/examples/guides/exchanges/fanout_exchange_routing.rb +0 -28
  55. data/examples/guides/exchanges/headers_exchange_routing.rb +0 -31
  56. data/examples/guides/exchanges/mandatory_messages.rb +0 -30
  57. data/examples/guides/extensions/alternate_exchange.rb +0 -30
  58. data/examples/guides/extensions/basic_nack.rb +0 -33
  59. data/examples/guides/extensions/connection_blocked.rb +0 -35
  60. data/examples/guides/extensions/consumer_cancellation_notification.rb +0 -39
  61. data/examples/guides/extensions/dead_letter_exchange.rb +0 -32
  62. data/examples/guides/extensions/exchange_to_exchange_bindings.rb +0 -29
  63. data/examples/guides/extensions/per_message_ttl.rb +0 -36
  64. data/examples/guides/extensions/per_queue_message_ttl.rb +0 -36
  65. data/examples/guides/extensions/publisher_confirms.rb +0 -28
  66. data/examples/guides/extensions/queue_lease.rb +0 -26
  67. data/examples/guides/extensions/sender_selected_distribution.rb +0 -32
  68. data/examples/guides/getting_started/blabbr.rb +0 -27
  69. data/examples/guides/getting_started/hello_world.rb +0 -22
  70. data/examples/guides/getting_started/weathr.rb +0 -49
  71. data/examples/guides/queues/one_off_consumer.rb +0 -25
  72. data/examples/guides/queues/redeliveries.rb +0 -81
  73. data/profiling/basic_publish/with_4K_messages.rb +0 -33
  74. data/repl +0 -3
  75. data/spec/tls/generate-server-cert.sh +0 -8
  76. data/spec/tls/server-openssl.cnf +0 -10
  77. data/spec/tls/server.csr +0 -16
data/Gemfile DELETED
@@ -1,55 +0,0 @@
1
- # encoding: utf-8
2
-
3
- source "https://rubygems.org"
4
-
5
- # Use local clones if possible.
6
- # If you want to use your local copy, just symlink it to vendor.
7
- # See http://blog.101ideas.cz/posts/custom-gems-in-gemfile.html
8
- extend Module.new {
9
- def gem(name, *args)
10
- options = args.last.is_a?(Hash) ? args.last : Hash.new
11
-
12
- local_path = File.expand_path("../vendor/#{name}", __FILE__)
13
- if File.exist?(local_path)
14
- super name, options.merge(path: local_path).
15
- delete_if { |key, _| [:git, :branch].include?(key) }
16
- else
17
- super name, *args
18
- end
19
- end
20
- }
21
-
22
- gem "rake", ">= 12.3.1"
23
-
24
- group :development do
25
- gem "yard"
26
-
27
- gem "redcarpet", platform: :mri
28
- gem "ruby-prof", platform: :mri
29
-
30
- gem "ripl"
31
- gem "ripl-multi_line"
32
- gem "ripl-irb"
33
- end
34
-
35
- group :test do
36
- gem "rspec", "~> 3.9.0"
37
- gem "rabbitmq_http_api_client", "~> 1.13.0", require: "rabbitmq/http/client"
38
- gem "toxiproxy", "~> 1.0.3"
39
- end
40
-
41
- gemspec
42
-
43
- # Use local clones if possible.
44
- # If you want to use your local copy, just symlink it to vendor.
45
- def custom_gem(name, options = Hash.new)
46
- local_path = File.expand_path("../vendor/#{name}", __FILE__)
47
- if File.exist?(local_path)
48
- puts "Using #{name} from #{local_path}..."
49
- gem name, options.merge(path: local_path).delete_if { |key, _| [:git, :branch].include?(key) }
50
- else
51
- gem name, options
52
- end
53
- end
54
-
55
- custom_gem "amq-protocol", git: "https://github.com/ruby-amqp/amq-protocol", branch: "master"
data/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- Copyright (c) 2009–2019 Chris Duncan, Jakub Stastny aka botanicus,
2
- Michael S. Klishin, Eric Lindvall, Stefan Kaes and contributors.
3
-
4
- Permission is hereby granted, free of charge, to any person obtaining
5
- a copy of this software and associated documentation files (the
6
- "Software"), to deal in the Software without restriction, including
7
- without limitation the rights to use, copy, modify, merge, publish,
8
- distribute, sublicense, and/or sell copies of the Software, and to
9
- permit persons to whom the Software is furnished to do so, subject to
10
- the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be
13
- included in all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile DELETED
@@ -1,54 +0,0 @@
1
- require 'rake'
2
- require 'rspec/core/rake_task'
3
-
4
- RSpec::Core::RakeTask.new(:integration) do |t|
5
- # excludes unit tests as those involve many iterations
6
- # and sometimes suffer from obscure interference from integration tests (!)
7
- t.pattern = ["spec/higher_level_api/integration", "spec/lower_level_api/integration", "spec/issues"].
8
- map { |dir| Dir.glob(File.join(dir, "**", "*_spec.rb")) }.reduce(&:+) - ["spec/higher_level_api/integration/tls_connection_spec.rb"]
9
-
10
- t.rspec_opts = "--format progress"
11
- end
12
-
13
- RSpec::Core::RakeTask.new(:integration_without_recovery) do |t|
14
- # same as :integration but excludes client connection recovery tests.
15
- # useful for sanity checking edge RabbitMQ builds, for instance.
16
- t.pattern = ["spec/higher_level_api/integration", "spec/lower_level_api/integration", "spec/issues"].
17
- map { |dir| Dir.glob(File.join(dir, "**", "*_spec.rb")) }.reduce(&:+) -
18
- ["spec/higher_level_api/integration/tls_connection_spec.rb",
19
- "spec/higher_level_api/integration/connection_recovery_spec.rb"]
20
-
21
- t.rspec_opts = "--format progress"
22
- end
23
-
24
- RSpec::Core::RakeTask.new(:unit) do |t|
25
- t.pattern = Dir.glob("spec/unit/**/*_spec.rb")
26
-
27
- t.rspec_opts = "--format progress --backtrace"
28
- end
29
-
30
- RSpec::Core::RakeTask.new(:recovery_integration) do |t|
31
- # otherwise all examples will be skipped
32
- ENV.delete("CI")
33
- t.pattern = ["spec/higher_level_api/integration/connection_recovery_spec.rb"]
34
-
35
- t.rspec_opts = "--format progress --backtrace"
36
- end
37
-
38
- RSpec::Core::RakeTask.new(:stress) do |t|
39
- # excludes unit tests as those involve many iterations
40
- # and sometimes suffer from obscure interference from integration tests (!)
41
- t.pattern = ["spec/stress/**/*_spec.rb"]
42
-
43
- t.rspec_opts = "--format progress"
44
- end
45
-
46
- task :default => :integration
47
-
48
- namespace :tls do
49
- desc "Checks the certificates and keys in BUNNY_CERTIFICATE_DIR with openssl s_client"
50
- task :s_client do
51
- dir = ENV["BUNNY_CERTIFICATE_DIR"]
52
- sh "openssl s_client -tls1_2 -connect 127.0.0.1:5671 -cert #{dir}/client_certificate.pem -key #{dir}/client_key.pem -CAfile #{dir}/ca_certificate.pem"
53
- end
54
- end
@@ -1,35 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
-
4
- require "rubygems"
5
- require "bunny"
6
- require "benchmark"
7
-
8
- conn = Bunny.new
9
- conn.start
10
-
11
- puts
12
- puts "-" * 80
13
- puts "Benchmarking on #{RUBY_DESCRIPTION}"
14
-
15
- n = 50_000
16
- ch = conn.create_channel
17
- x = ch.default_exchange
18
- s = "z" * (1024 * 128)
19
-
20
- # warm up the JIT, etc
21
- puts "Doing a warmup run..."
22
- 16000.times { x.publish(s, :routing_key => "anything") }
23
-
24
- # give OS, the server and so on some time to catch
25
- # up
26
- sleep 2.0
27
-
28
- t = Benchmark.realtime do
29
- n.times { x.publish(s, :routing_key => "anything") }
30
- end
31
- r = (n.to_f/t.to_f)
32
-
33
- puts "Publishing rate with #{s.bytesize} bytes/msg: #{(r / 1000).round(2)} KGHz"
34
- puts
35
- puts "-" * 80
@@ -1,35 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
-
4
- require "rubygems"
5
- require "bunny"
6
- require "benchmark"
7
-
8
- conn = Bunny.new
9
- conn.start
10
-
11
- puts
12
- puts "-" * 80
13
- puts "Benchmarking on #{RUBY_DESCRIPTION}"
14
-
15
- n = 50_000
16
- ch = conn.create_channel
17
- x = ch.default_exchange
18
- s = "z" * 1024
19
-
20
- # warm up the JIT, etc
21
- puts "Doing a warmup run..."
22
- 16000.times { x.publish(s, :routing_key => "anything") }
23
-
24
- # give OS, the server and so on some time to catch
25
- # up
26
- sleep 2.0
27
-
28
- t = Benchmark.realtime do
29
- n.times { x.publish(s, :routing_key => "anything") }
30
- end
31
- r = (n.to_f/t.to_f)
32
-
33
- puts "Publishing rate with #{s.bytesize} bytes/msg: #{(r / 1000).round(2)} KGHz"
34
- puts
35
- puts "-" * 80
@@ -1,35 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
-
4
- require "rubygems"
5
- require "bunny"
6
- require "benchmark"
7
-
8
- conn = Bunny.new
9
- conn.start
10
-
11
- puts
12
- puts "-" * 80
13
- puts "Benchmarking on #{RUBY_DESCRIPTION}"
14
-
15
- n = 50_000
16
- ch = conn.create_channel
17
- x = ch.default_exchange
18
- s = "z" * 4096
19
-
20
- # warm up the JIT, etc
21
- puts "Doing a warmup run..."
22
- 16000.times { x.publish(s, :routing_key => "anything") }
23
-
24
- # give OS, the server and so on some time to catch
25
- # up
26
- sleep 2.0
27
-
28
- t = Benchmark.realtime do
29
- n.times { x.publish(s, :routing_key => "anything") }
30
- end
31
- r = (n.to_f/t.to_f)
32
-
33
- puts "Publishing rate with #{s.bytesize} bytes/msg: #{(r / 1000).round(2)} KGHz"
34
- puts
35
- puts "-" * 80
@@ -1,35 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
-
4
- require "rubygems"
5
- require "bunny"
6
- require "benchmark"
7
-
8
- conn = Bunny.new
9
- conn.start
10
-
11
- puts
12
- puts "-" * 80
13
- puts "Benchmarking on #{RUBY_DESCRIPTION}"
14
-
15
- n = 50_000
16
- ch = conn.create_channel
17
- x = ch.default_exchange
18
- s = "z" * (1024 * 64)
19
-
20
- # warm up the JIT, etc
21
- puts "Doing a warmup run..."
22
- 16000.times { x.publish(s, :routing_key => "anything") }
23
-
24
- # give OS, the server and so on some time to catch
25
- # up
26
- sleep 2.0
27
-
28
- t = Benchmark.realtime do
29
- n.times { x.publish(s, :routing_key => "anything") }
30
- end
31
- r = (n.to_f/t.to_f)
32
-
33
- puts "Publishing rate with #{s.bytesize} bytes/msg: #{(r / 1000).round(2)} KGHz"
34
- puts
35
- puts "-" * 80
@@ -1,28 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
-
4
- require "rubygems"
5
- require "bunny"
6
- require "benchmark"
7
-
8
- conn = Bunny.new
9
- conn.start
10
-
11
- puts
12
- puts "-" * 80
13
- puts "Benchmarking on #{RUBY_DESCRIPTION}"
14
-
15
- n = 500
16
-
17
- # warm up the JIT, etc
18
- puts "Doing a warmup run..."
19
- 1000.times { conn.create_channel }
20
-
21
- t = Benchmark.realtime do
22
- n.times { conn.create_channel }
23
- end
24
- r = (n.to_f/t.to_f)
25
-
26
- puts "channel.open rate: #{(r / 1000).round(2)} KGHz"
27
- puts
28
- puts "-" * 80
@@ -1,42 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
-
4
- require "rubygems"
5
- require "set"
6
- require "thread"
7
- require "benchmark"
8
- require "monitor"
9
-
10
- puts
11
- puts "-" * 80
12
- puts "Benchmarking on #{RUBY_DESCRIPTION}"
13
-
14
- n = 2_000_000
15
- mx = Mutex.new
16
- mt = Monitor.new
17
-
18
- # warm up the JIT, etc
19
- puts "Doing a warmup run..."
20
- n.times do |i|
21
- mx.synchronize { 1 }
22
- mt.synchronize { 1 }
23
- end
24
-
25
- t1 = Benchmark.realtime do
26
- n.times do |i|
27
- mx.synchronize { 1 }
28
- end
29
- end
30
- r1 = (n.to_f/t1.to_f)
31
-
32
- t2 = Benchmark.realtime do
33
- n.times do |i|
34
- mt.synchronize { 1 }
35
- end
36
- end
37
- r2 = (n.to_f/t2.to_f)
38
-
39
- puts "Mutex#synchronize, rate: #{(r1 / 1000).round(2)} KGHz"
40
- puts "Monitor#synchronize, rate: #{(r2 / 1000).round(2)} KGHz"
41
- puts
42
- puts "-" * 80
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
-
4
- require "rubygems"
5
- require "bunny"
6
- require "benchmark"
7
-
8
- conn = Bunny.new
9
- conn.start
10
- ch = conn.create_channel
11
-
12
- puts
13
- puts "-" * 80
14
- puts "Benchmarking on #{RUBY_DESCRIPTION}"
15
-
16
- n = 4000
17
-
18
- # warm up the JIT, etc
19
- puts "Doing a warmup run..."
20
- n.times { ch.queue("", :exclusive => true) }
21
-
22
- t = Benchmark.realtime do
23
- n.times { ch.queue("", :exclusive => true) }
24
- end
25
- r = (n.to_f/t.to_f)
26
-
27
- puts "queue.declare (server-named, exclusive = true) rate: #{(r / 1000).round(2)} KGHz"
28
- puts
29
- puts "-" * 80
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
-
4
- require "rubygems"
5
- require "bunny"
6
- require "benchmark"
7
-
8
- conn = Bunny.new
9
- conn.start
10
- ch = conn.create_channel
11
-
12
- puts
13
- puts "-" * 80
14
- puts "Benchmarking on #{RUBY_DESCRIPTION}"
15
-
16
- n = 4000
17
-
18
- # warm up the JIT, etc
19
- puts "Doing a warmup run..."
20
- n.times { ch.queue("", :exclusive => true).bind("amq.fanout") }
21
-
22
- t = Benchmark.realtime do
23
- n.times { ch.queue("", :exclusive => true).bind("amq.fanout") }
24
- end
25
- r = (n.to_f/t.to_f)
26
-
27
- puts "queue.declare + queue.bind rate: #{(r / 1000).round(2)} KGHz"
28
- puts
29
- puts "-" * 80
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
-
4
- require "rubygems"
5
- require "bunny"
6
- require "benchmark"
7
-
8
- conn = Bunny.new
9
- conn.start
10
- ch = conn.create_channel
11
-
12
- puts
13
- puts "-" * 80
14
- puts "Benchmarking on #{RUBY_DESCRIPTION}"
15
-
16
- n = 4000
17
-
18
- # warm up the JIT, etc
19
- puts "Doing a warmup run..."
20
- n.times { ch.queue("", :exclusive => true).bind("amq.fanout").delete }
21
-
22
- t = Benchmark.realtime do
23
- n.times { ch.queue("", :exclusive => true).bind("amq.fanout").delete }
24
- end
25
- r = (n.to_f/t.to_f)
26
-
27
- puts "queue.declare + queue.bind + queue.delete rate: #{(r / 1000).round(2)} KGHz"
28
- puts
29
- puts "-" * 80