bunny 2.7.4 → 2.22.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 (156) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +61 -35
  3. data/lib/bunny/channel.rb +186 -50
  4. data/lib/bunny/channel_id_allocator.rb +3 -1
  5. data/lib/bunny/consumer.rb +2 -2
  6. data/lib/bunny/consumer_work_pool.rb +2 -1
  7. data/lib/bunny/cruby/socket.rb +3 -0
  8. data/lib/bunny/cruby/ssl_socket.rb +6 -1
  9. data/lib/bunny/delivery_info.rb +1 -1
  10. data/lib/bunny/heartbeat_sender.rb +2 -1
  11. data/lib/bunny/jruby/ssl_socket.rb +5 -0
  12. data/lib/bunny/queue.rb +36 -8
  13. data/lib/bunny/reader_loop.rb +22 -10
  14. data/lib/bunny/session.rb +152 -65
  15. data/lib/bunny/test_kit.rb +14 -0
  16. data/lib/bunny/transport.rb +132 -49
  17. data/lib/bunny/version.rb +1 -1
  18. data/lib/bunny.rb +45 -4
  19. metadata +37 -225
  20. data/.github/ISSUE_TEMPLATE.md +0 -18
  21. data/.gitignore +0 -28
  22. data/.rspec +0 -1
  23. data/.travis.yml +0 -20
  24. data/.yardopts +0 -8
  25. data/CONTRIBUTING.md +0 -111
  26. data/ChangeLog.md +0 -1831
  27. data/Gemfile +0 -53
  28. data/LICENSE +0 -21
  29. data/Rakefile +0 -46
  30. data/benchmarks/basic_publish/with_128K_messages.rb +0 -35
  31. data/benchmarks/basic_publish/with_1k_messages.rb +0 -35
  32. data/benchmarks/basic_publish/with_4K_messages.rb +0 -35
  33. data/benchmarks/basic_publish/with_64K_messages.rb +0 -35
  34. data/benchmarks/channel_open.rb +0 -28
  35. data/benchmarks/mutex_and_monitor.rb +0 -42
  36. data/benchmarks/queue_declare.rb +0 -29
  37. data/benchmarks/queue_declare_and_bind.rb +0 -29
  38. data/benchmarks/queue_declare_bind_and_delete.rb +0 -29
  39. data/benchmarks/synchronized_sorted_set.rb +0 -53
  40. data/benchmarks/write_vs_write_nonblock.rb +0 -49
  41. data/bin/ci/before_build +0 -46
  42. data/bunny.gemspec +0 -35
  43. data/docker/Dockerfile +0 -16
  44. data/docker/docker-entrypoint.sh +0 -37
  45. data/docker-compose.yml +0 -18
  46. data/examples/connection/authentication_failure.rb +0 -16
  47. data/examples/connection/automatic_recovery_with_basic_get.rb +0 -40
  48. data/examples/connection/automatic_recovery_with_client_named_queues.rb +0 -36
  49. data/examples/connection/automatic_recovery_with_multiple_consumers.rb +0 -46
  50. data/examples/connection/automatic_recovery_with_republishing.rb +0 -109
  51. data/examples/connection/automatic_recovery_with_server_named_queues.rb +0 -35
  52. data/examples/connection/channel_level_exception.rb +0 -27
  53. data/examples/connection/disabled_automatic_recovery.rb +0 -34
  54. data/examples/connection/heartbeat.rb +0 -17
  55. data/examples/connection/manually_reconnecting_consumer.rb +0 -23
  56. data/examples/connection/manually_reconnecting_publisher.rb +0 -28
  57. data/examples/connection/unknown_host.rb +0 -16
  58. data/examples/consumers/high_and_low_priority.rb +0 -50
  59. data/examples/guides/exchanges/direct_exchange_routing.rb +0 -36
  60. data/examples/guides/exchanges/fanout_exchange_routing.rb +0 -28
  61. data/examples/guides/exchanges/headers_exchange_routing.rb +0 -31
  62. data/examples/guides/exchanges/mandatory_messages.rb +0 -30
  63. data/examples/guides/extensions/alternate_exchange.rb +0 -30
  64. data/examples/guides/extensions/basic_nack.rb +0 -33
  65. data/examples/guides/extensions/connection_blocked.rb +0 -35
  66. data/examples/guides/extensions/consumer_cancellation_notification.rb +0 -39
  67. data/examples/guides/extensions/dead_letter_exchange.rb +0 -32
  68. data/examples/guides/extensions/exchange_to_exchange_bindings.rb +0 -29
  69. data/examples/guides/extensions/per_message_ttl.rb +0 -36
  70. data/examples/guides/extensions/per_queue_message_ttl.rb +0 -36
  71. data/examples/guides/extensions/publisher_confirms.rb +0 -28
  72. data/examples/guides/extensions/queue_lease.rb +0 -26
  73. data/examples/guides/extensions/sender_selected_distribution.rb +0 -32
  74. data/examples/guides/getting_started/blabbr.rb +0 -27
  75. data/examples/guides/getting_started/hello_world.rb +0 -22
  76. data/examples/guides/getting_started/weathr.rb +0 -49
  77. data/examples/guides/queues/one_off_consumer.rb +0 -25
  78. data/examples/guides/queues/redeliveries.rb +0 -81
  79. data/profiling/basic_publish/with_4K_messages.rb +0 -33
  80. data/repl +0 -3
  81. data/spec/config/enabled_plugins +0 -1
  82. data/spec/config/rabbitmq.config +0 -19
  83. data/spec/higher_level_api/integration/basic_ack_spec.rb +0 -230
  84. data/spec/higher_level_api/integration/basic_cancel_spec.rb +0 -142
  85. data/spec/higher_level_api/integration/basic_consume_spec.rb +0 -349
  86. data/spec/higher_level_api/integration/basic_consume_with_objects_spec.rb +0 -54
  87. data/spec/higher_level_api/integration/basic_get_spec.rb +0 -80
  88. data/spec/higher_level_api/integration/basic_nack_spec.rb +0 -82
  89. data/spec/higher_level_api/integration/basic_publish_spec.rb +0 -74
  90. data/spec/higher_level_api/integration/basic_qos_spec.rb +0 -57
  91. data/spec/higher_level_api/integration/basic_reject_spec.rb +0 -152
  92. data/spec/higher_level_api/integration/basic_return_spec.rb +0 -33
  93. data/spec/higher_level_api/integration/channel_close_spec.rb +0 -25
  94. data/spec/higher_level_api/integration/channel_open_spec.rb +0 -57
  95. data/spec/higher_level_api/integration/connection_recovery_spec.rb +0 -471
  96. data/spec/higher_level_api/integration/connection_spec.rb +0 -559
  97. data/spec/higher_level_api/integration/connection_stop_spec.rb +0 -83
  98. data/spec/higher_level_api/integration/consumer_cancellation_notification_spec.rb +0 -128
  99. data/spec/higher_level_api/integration/dead_lettering_spec.rb +0 -75
  100. data/spec/higher_level_api/integration/exchange_bind_spec.rb +0 -31
  101. data/spec/higher_level_api/integration/exchange_declare_spec.rb +0 -237
  102. data/spec/higher_level_api/integration/exchange_delete_spec.rb +0 -105
  103. data/spec/higher_level_api/integration/exchange_unbind_spec.rb +0 -40
  104. data/spec/higher_level_api/integration/exclusive_queue_spec.rb +0 -28
  105. data/spec/higher_level_api/integration/heartbeat_spec.rb +0 -49
  106. data/spec/higher_level_api/integration/merry_go_round_spec.rb +0 -85
  107. data/spec/higher_level_api/integration/message_properties_access_spec.rb +0 -95
  108. data/spec/higher_level_api/integration/predeclared_exchanges_spec.rb +0 -24
  109. data/spec/higher_level_api/integration/publisher_confirms_spec.rb +0 -191
  110. data/spec/higher_level_api/integration/publishing_edge_cases_spec.rb +0 -87
  111. data/spec/higher_level_api/integration/queue_bind_spec.rb +0 -109
  112. data/spec/higher_level_api/integration/queue_declare_spec.rb +0 -221
  113. data/spec/higher_level_api/integration/queue_delete_spec.rb +0 -41
  114. data/spec/higher_level_api/integration/queue_purge_spec.rb +0 -30
  115. data/spec/higher_level_api/integration/queue_unbind_spec.rb +0 -54
  116. data/spec/higher_level_api/integration/read_only_consumer_spec.rb +0 -60
  117. data/spec/higher_level_api/integration/sender_selected_distribution_spec.rb +0 -36
  118. data/spec/higher_level_api/integration/tls_connection_spec.rb +0 -222
  119. data/spec/higher_level_api/integration/tx_commit_spec.rb +0 -21
  120. data/spec/higher_level_api/integration/tx_rollback_spec.rb +0 -21
  121. data/spec/higher_level_api/integration/with_channel_spec.rb +0 -25
  122. data/spec/issues/issue100_spec.rb +0 -42
  123. data/spec/issues/issue141_spec.rb +0 -43
  124. data/spec/issues/issue202_spec.rb +0 -15
  125. data/spec/issues/issue224_spec.rb +0 -40
  126. data/spec/issues/issue465_spec.rb +0 -32
  127. data/spec/issues/issue78_spec.rb +0 -72
  128. data/spec/issues/issue83_spec.rb +0 -30
  129. data/spec/issues/issue97_attachment.json +0 -1
  130. data/spec/issues/issue97_spec.rb +0 -175
  131. data/spec/lower_level_api/integration/basic_cancel_spec.rb +0 -83
  132. data/spec/lower_level_api/integration/basic_consume_spec.rb +0 -99
  133. data/spec/spec_helper.rb +0 -51
  134. data/spec/stress/channel_close_stress_spec.rb +0 -64
  135. data/spec/stress/channel_open_stress_spec.rb +0 -84
  136. data/spec/stress/channel_open_stress_with_single_threaded_connection_spec.rb +0 -28
  137. data/spec/stress/concurrent_consumers_stress_spec.rb +0 -71
  138. data/spec/stress/concurrent_publishers_stress_spec.rb +0 -54
  139. data/spec/stress/connection_open_close_spec.rb +0 -52
  140. data/spec/stress/long_running_consumer_spec.rb +0 -84
  141. data/spec/tls/ca_certificate.pem +0 -29
  142. data/spec/tls/ca_key.pem +0 -52
  143. data/spec/tls/client_certificate.pem +0 -29
  144. data/spec/tls/client_key.pem +0 -51
  145. data/spec/tls/generate-server-cert.sh +0 -8
  146. data/spec/tls/server-openssl.cnf +0 -10
  147. data/spec/tls/server.csr +0 -16
  148. data/spec/tls/server_certificate.pem +0 -29
  149. data/spec/tls/server_key.pem +0 -51
  150. data/spec/unit/bunny_spec.rb +0 -15
  151. data/spec/unit/concurrent/atomic_fixnum_spec.rb +0 -35
  152. data/spec/unit/concurrent/condition_spec.rb +0 -82
  153. data/spec/unit/concurrent/linked_continuation_queue_spec.rb +0 -35
  154. data/spec/unit/concurrent/synchronized_sorted_set_spec.rb +0 -73
  155. data/spec/unit/exchange_recovery_spec.rb +0 -39
  156. data/spec/unit/version_delivery_tag_spec.rb +0 -28
data/Gemfile DELETED
@@ -1,53 +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", ">= 10.0.4"
23
- gem "effin_utf8"
24
-
25
- group :development do
26
- gem "yard"
27
-
28
- gem "redcarpet", :platform => :mri
29
- gem "ruby-prof", :platform => :mri
30
-
31
- gem "json", :platform => :ruby_18
32
- end
33
-
34
- group :test do
35
- gem "rspec", "~> 3.5.0"
36
- gem "rabbitmq_http_api_client", "~> 1.9.1"
37
- end
38
-
39
- gemspec
40
-
41
- # Use local clones if possible.
42
- # If you want to use your local copy, just symlink it to vendor.
43
- def custom_gem(name, options = Hash.new)
44
- local_path = File.expand_path("../vendor/#{name}", __FILE__)
45
- if File.exist?(local_path)
46
- # puts "Using #{name} from #{local_path}..."
47
- gem name, options.merge(:path => local_path).delete_if { |key, _| [:git, :branch].include?(key) }
48
- else
49
- gem name, options
50
- end
51
- end
52
-
53
- custom_gem "amq-protocol", "~> 2.2.0"
data/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- Copyright (c) 2009 – 2017 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,46 +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
@@ -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
@@ -1,53 +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
-
9
- require "bunny/concurrent/synchronized_sorted_set"
10
-
11
- puts
12
- puts "-" * 80
13
- puts "Benchmarking on #{RUBY_DESCRIPTION}"
14
-
15
- n = 2_000_000
16
- s = SortedSet.new
17
-
18
- # warm up the JIT, etc
19
- puts "Doing a warmup run..."
20
- n.times do |i|
21
- s << 1
22
- s << i
23
- s.delete i
24
- s << i
25
- end
26
-
27
- t1 = Benchmark.realtime do
28
- n.times do |i|
29
- s << 1
30
- s << i
31
- s.delete i
32
- s << i
33
- s.length
34
- end
35
- end
36
- r1 = (n.to_f/t1.to_f)
37
-
38
- s2 = SynchronizedSortedSet.new
39
- t2 = Benchmark.realtime do
40
- n.times do |i|
41
- s2 << 1
42
- s2 << i
43
- s2.delete i
44
- s2 << i
45
- s2.length
46
- end
47
- end
48
- r2 = (n.to_f/t2.to_f)
49
-
50
- puts "Mixed sorted set ops, rate: #{(r1 / 1000).round(2)} KGHz"
51
- puts "Mixed synchronized sorted set ops, rate: #{(r2 / 1000).round(2)} KGHz"
52
- puts
53
- puts "-" * 80
@@ -1,49 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "benchmark"
4
-
5
- # This tests demonstrates throughput difference of
6
- # IO#write and IO#write_nonblock. Note that the two
7
- # may not be equivalent depending on your
8
-
9
- r, w = IO.pipe
10
-
11
- # buffer size
12
- b = 65536
13
-
14
- read_loop = Thread.new do
15
- loop do
16
- begin
17
- r.read_nonblock(b)
18
- rescue Errno::EWOULDBLOCK, Errno::EAGAIN => e
19
- IO.select([r])
20
- retry
21
- end
22
- end
23
- end
24
-
25
- n = 10_000
26
- # 7 KB
27
- s = "a" * (7 * 1024)
28
- Benchmark.bm do |meter|
29
- meter.report("write:") do
30
- n.times { w.write(s.dup) }
31
- end
32
- meter.report("write + flush:") do
33
- n.times { w.write(s.dup); w.flush }
34
- end
35
- meter.report("write_nonblock:") do
36
- n.times do
37
- s2 = s.dup
38
- begin
39
- while !s2.empty?
40
- written = w.write_nonblock(s2)
41
- s2.slice!(0, written)
42
- end
43
- rescue Errno::EWOULDBLOCK, Errno::EAGAIN
44
- IO.select([], [w])
45
- retry
46
- end
47
- end
48
- end
49
- end
data/bin/ci/before_build DELETED
@@ -1,46 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- $ctl = ENV["BUNNY_RABBITMQCTL"] || ENV["RABBITMQCTL"] || "sudo rabbitmqctl"
4
- $plugins = ENV["BUNNY_RABBITMQ_PLUGINS"] || ENV["RABBITMQ_PLUGINS"] || "sudo rabbitmq-plugins"
5
-
6
- def rabbit_control(args)
7
- command = "#{$ctl} #{args}"
8
- system command
9
- end
10
-
11
- def rabbit_plugins(args)
12
- command = "#{$plugins} #{args}"
13
- system command
14
- end
15
-
16
-
17
- # guest:guest has full access to /
18
-
19
- rabbit_control 'add_vhost /'
20
- rabbit_control 'add_user guest guest'
21
- rabbit_control 'set_permissions -p / guest ".*" ".*" ".*"'
22
-
23
-
24
- # bunny_gem:bunny_password has full access to bunny_testbed
25
-
26
- rabbit_control 'add_vhost bunny_testbed'
27
- rabbit_control 'add_user bunny_gem bunny_password'
28
- rabbit_control 'set_permissions -p bunny_testbed bunny_gem ".*" ".*" ".*"'
29
-
30
-
31
- # guest:guest has full access to bunny_testbed
32
-
33
- rabbit_control 'set_permissions -p bunny_testbed guest ".*" ".*" ".*"'
34
-
35
-
36
- # bunny_reader:reader_password has read access to bunny_testbed
37
-
38
- rabbit_control 'add_user bunny_reader reader_password'
39
- rabbit_control 'set_permissions -p bunny_testbed bunny_reader "^---$" "^---$" ".*"'
40
-
41
- # requires RabbitMQ 3.0+
42
- # rabbit_plugins 'enable rabbitmq_management'
43
-
44
- # Reduce retention policy for faster publishing of stats
45
- rabbit_control "eval 'supervisor2:terminate_child(rabbit_mgmt_sup_sup, rabbit_mgmt_sup), application:set_env(rabbitmq_management, sample_retention_policies, [{global, [{605, 1}]}, {basic, [{605, 1}]}, {detailed, [{10, 1}]}]), rabbit_mgmt_sup_sup:start_child().'"
46
- rabbit_control "eval 'supervisor2:terminate_child(rabbit_mgmt_agent_sup_sup, rabbit_mgmt_agent_sup), application:set_env(rabbitmq_management_agent, sample_retention_policies, [{global, [{605, 1}]}, {basic, [{605, 1}]}, {detailed, [{10, 1}]}]), rabbit_mgmt_agent_sup_sup:start_child().'"
data/bunny.gemspec DELETED
@@ -1,35 +0,0 @@
1
- #!/usr/bin/env gem build
2
- # encoding: utf-8
3
-
4
- require "base64"
5
- require File.expand_path("../lib/bunny/version", __FILE__)
6
-
7
- Gem::Specification.new do |s|
8
- s.name = "bunny"
9
- s.version = Bunny::VERSION.dup
10
- s.homepage = "http://rubybunny.info"
11
- s.summary = "Popular easy to use Ruby client for RabbitMQ"
12
- s.description = "Easy to use, feature complete Ruby client for RabbitMQ 3.3 and later versions."
13
- s.license = "MIT"
14
- s.required_ruby_version = Gem::Requirement.new(">= 2.0")
15
-
16
- # Sorted alphabetically.
17
- s.authors = [
18
- "Chris Duncan",
19
- "Eric Lindvall",
20
- "Jakub Stastny aka botanicus",
21
- "Michael S. Klishin",
22
- "Stefan Kaes"]
23
-
24
- s.email = ["michael.s.klishin@gmail.com"]
25
-
26
- # Dependencies
27
- s.add_dependency "amq-protocol", "~> 2.2.0"
28
-
29
- # Files.
30
- s.has_rdoc = true
31
- s.extra_rdoc_files = ["README.md"]
32
- s.files = `git ls-files`.split("\n")
33
- s.test_files = `git ls-files -- spec/*`.split("\n")
34
- s.require_paths = ["lib"]
35
- end
data/docker/Dockerfile DELETED
@@ -1,16 +0,0 @@
1
- FROM debian:jessie
2
-
3
- RUN apt-get -q update && \
4
- apt-get install -yq --no-install-recommends wget ca-certificates
5
-
6
- RUN echo 'deb http://www.rabbitmq.com/debian/ testing main' > /etc/apt/sources.list.d/rabbitmq.list && \
7
- wget -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | apt-key add -
8
-
9
- RUN apt-get -q update && \
10
- apt-get install -yq --no-install-recommends rabbitmq-server
11
-
12
- COPY docker-entrypoint.sh /
13
-
14
- ENTRYPOINT /docker-entrypoint.sh
15
-
16
- EXPOSE 5671 5672 15672
@@ -1,37 +0,0 @@
1
- #!/bin/sh
2
- server=rabbitmq-server
3
- ctl=rabbitmqctl
4
- delay=3
5
-
6
- echo "[Configuration] $(eval cat $RABBITMQ_CONFIG_FILE.config)"
7
-
8
- echo '[Configuration] Starting RabbitMQ in detached mode.'
9
-
10
- $server -detached
11
-
12
- echo "[Configuration] Waiting $delay seconds for RabbitMQ to start."
13
-
14
- sleep $delay
15
-
16
- echo '*** Creating users ***'
17
- $ctl add_user bunny_gem bunny_password
18
- $ctl add_user bunny_reader reader_password
19
-
20
- echo '*** Creating virtual hosts ***'
21
- $ctl add_vhost bunny_testbed
22
-
23
- echo '*** Setting virtual host permissions ***'
24
- $ctl set_permissions -p / guest '.*' '.*' '.*'
25
- $ctl set_permissions -p bunny_testbed bunny_gem '.*' '.*' '.*'
26
- $ctl set_permissions -p bunny_testbed guest '.*' '.*' '.*'
27
- $ctl set_permissions -p bunny_testbed bunny_reader '^---$' '^---$' '.*'
28
-
29
- $ctl stop
30
-
31
- echo "[Configuration] Waiting $delay seconds for RabbitMQ to stop."
32
-
33
- sleep $delay
34
-
35
- echo 'Starting RabbitMQ in foreground (CTRL-C to exit)'
36
-
37
- exec $server
data/docker-compose.yml DELETED
@@ -1,18 +0,0 @@
1
- version: '2'
2
- services:
3
- rabbitmq:
4
- build: ./docker
5
- container_name: bunny_rabbitmq
6
- environment:
7
- RABBITMQ_NODENAME: bunny
8
- # link to spec specific configuration
9
- RABBITMQ_CONFIG_FILE: /spec/config/rabbitmq
10
- RABBITMQ_ENABLED_PLUGINS_FILE: /spec/config/enabled_plugins
11
- # send logs to stdout
12
- RABBITMQ_LOGS: '-'
13
- RABBITMQ_SASL_LOGS: '-'
14
- ports:
15
- - 5671-5672:5671-5672
16
- - 15672:15672
17
- volumes:
18
- - ./spec:/spec:ro