bunny 2.15.0 → 2.19.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 +4 -4
- data/README.md +30 -12
- data/lib/bunny/channel.rb +2 -2
- data/lib/bunny/reader_loop.rb +11 -11
- data/lib/bunny/session.rb +32 -9
- data/lib/bunny/transport.rb +12 -11
- data/lib/bunny/version.rb +1 -1
- data/spec/higher_level_api/integration/basic_consume_spec.rb +14 -6
- data/spec/higher_level_api/integration/connection_spec.rb +26 -0
- data/spec/higher_level_api/integration/tls_connection_spec.rb +25 -32
- data/spec/issues/issue609_spec.rb +84 -0
- data/spec/lower_level_api/integration/basic_cancel_spec.rb +1 -1
- data/spec/lower_level_api/integration/basic_consume_spec.rb +8 -8
- metadata +28 -87
- data/.github/ISSUE_TEMPLATE.md +0 -18
- data/.gitignore +0 -28
- data/.rspec +0 -1
- data/.travis.yml +0 -33
- data/.yardopts +0 -8
- data/CONTRIBUTING.md +0 -132
- data/ChangeLog.md +0 -2084
- data/Gemfile +0 -55
- data/LICENSE +0 -21
- data/Rakefile +0 -54
- data/benchmarks/basic_publish/with_128K_messages.rb +0 -35
- data/benchmarks/basic_publish/with_1k_messages.rb +0 -35
- data/benchmarks/basic_publish/with_4K_messages.rb +0 -35
- data/benchmarks/basic_publish/with_64K_messages.rb +0 -35
- data/benchmarks/channel_open.rb +0 -28
- data/benchmarks/mutex_and_monitor.rb +0 -42
- data/benchmarks/queue_declare.rb +0 -29
- data/benchmarks/queue_declare_and_bind.rb +0 -29
- data/benchmarks/queue_declare_bind_and_delete.rb +0 -29
- data/benchmarks/synchronized_sorted_set.rb +0 -53
- data/benchmarks/write_vs_write_nonblock.rb +0 -49
- data/bunny.gemspec +0 -34
- data/docker/Dockerfile +0 -24
- data/docker/apt/preferences.d/erlang +0 -3
- data/docker/apt/sources.list.d/bintray.rabbitmq.list +0 -2
- data/docker/docker-entrypoint.sh +0 -26
- data/docker/rabbitmq.conf +0 -29
- data/docker-compose.yml +0 -28
- data/examples/connection/authentication_failure.rb +0 -16
- data/examples/connection/automatic_recovery_with_basic_get.rb +0 -40
- data/examples/connection/automatic_recovery_with_client_named_queues.rb +0 -36
- data/examples/connection/automatic_recovery_with_multiple_consumers.rb +0 -46
- data/examples/connection/automatic_recovery_with_republishing.rb +0 -109
- data/examples/connection/automatic_recovery_with_server_named_queues.rb +0 -35
- data/examples/connection/channel_level_exception.rb +0 -27
- data/examples/connection/disabled_automatic_recovery.rb +0 -34
- data/examples/connection/heartbeat.rb +0 -17
- data/examples/connection/manually_reconnecting_consumer.rb +0 -23
- data/examples/connection/manually_reconnecting_publisher.rb +0 -28
- data/examples/connection/unknown_host.rb +0 -16
- data/examples/consumers/high_and_low_priority.rb +0 -50
- data/examples/guides/exchanges/direct_exchange_routing.rb +0 -36
- data/examples/guides/exchanges/fanout_exchange_routing.rb +0 -28
- data/examples/guides/exchanges/headers_exchange_routing.rb +0 -31
- data/examples/guides/exchanges/mandatory_messages.rb +0 -30
- data/examples/guides/extensions/alternate_exchange.rb +0 -30
- data/examples/guides/extensions/basic_nack.rb +0 -33
- data/examples/guides/extensions/connection_blocked.rb +0 -35
- data/examples/guides/extensions/consumer_cancellation_notification.rb +0 -39
- data/examples/guides/extensions/dead_letter_exchange.rb +0 -32
- data/examples/guides/extensions/exchange_to_exchange_bindings.rb +0 -29
- data/examples/guides/extensions/per_message_ttl.rb +0 -36
- data/examples/guides/extensions/per_queue_message_ttl.rb +0 -36
- data/examples/guides/extensions/publisher_confirms.rb +0 -28
- data/examples/guides/extensions/queue_lease.rb +0 -26
- data/examples/guides/extensions/sender_selected_distribution.rb +0 -32
- data/examples/guides/getting_started/blabbr.rb +0 -27
- data/examples/guides/getting_started/hello_world.rb +0 -22
- data/examples/guides/getting_started/weathr.rb +0 -49
- data/examples/guides/queues/one_off_consumer.rb +0 -25
- data/examples/guides/queues/redeliveries.rb +0 -81
- data/profiling/basic_publish/with_4K_messages.rb +0 -33
- data/repl +0 -3
- data/spec/tls/ca_certificate.pem +0 -29
- data/spec/tls/ca_key.pem +0 -52
- data/spec/tls/client_certificate.pem +0 -29
- data/spec/tls/client_key.pem +0 -51
- data/spec/tls/generate-server-cert.sh +0 -8
- data/spec/tls/server-openssl.cnf +0 -10
- data/spec/tls/server.csr +0 -16
- data/spec/tls/server_certificate.pem +0 -29
- data/spec/tls/server_key.pem +0 -51
    
        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
         | 
    
        data/benchmarks/channel_open.rb
    DELETED
    
    | @@ -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
         | 
    
        data/benchmarks/queue_declare.rb
    DELETED
    
    | @@ -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/bunny.gemspec
    DELETED
    
    | @@ -1,34 +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.2")
         | 
| 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_runtime_dependency 'amq-protocol', '~> 2.3', '>= 2.3.1'
         | 
| 28 | 
            -
             | 
| 29 | 
            -
              # Files.
         | 
| 30 | 
            -
              s.extra_rdoc_files = ["README.md"]
         | 
| 31 | 
            -
              s.files         = `git ls-files`.split("\n").reject { |f| f.match(%r{^bin/ci/}) }
         | 
| 32 | 
            -
              s.test_files    = `git ls-files -- spec/*`.split("\n")
         | 
| 33 | 
            -
              s.require_paths = ["lib"]
         | 
| 34 | 
            -
            end
         | 
    
        data/docker/Dockerfile
    DELETED
    
    | @@ -1,24 +0,0 @@ | |
| 1 | 
            -
            FROM ubuntu:18.04
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            RUN apt-get update -y
         | 
| 4 | 
            -
            RUN apt-get install -y gnupg2 wget
         | 
| 5 | 
            -
            RUN wget -O - "https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc" | apt-key add -
         | 
| 6 | 
            -
             | 
| 7 | 
            -
            COPY apt/sources.list.d/bintray.rabbitmq.list /etc/apt/sources.list.d/bintray.rabbitmq.list
         | 
| 8 | 
            -
            COPY apt/preferences.d/erlang                 /etc/apt/preferences.d/erlang
         | 
| 9 | 
            -
             | 
| 10 | 
            -
            RUN apt-get update -y && apt-get upgrade -y
         | 
| 11 | 
            -
             | 
| 12 | 
            -
            RUN apt-get install -y erlang-base \
         | 
| 13 | 
            -
                                   erlang-asn1 erlang-crypto erlang-eldap erlang-ftp erlang-inets \
         | 
| 14 | 
            -
                                   erlang-mnesia erlang-os-mon erlang-parsetools erlang-public-key \
         | 
| 15 | 
            -
                                   erlang-runtime-tools erlang-snmp erlang-ssl \
         | 
| 16 | 
            -
                                   erlang-syntax-tools erlang-tftp erlang-tools erlang-xmerl
         | 
| 17 | 
            -
             | 
| 18 | 
            -
            RUN apt-get install -y rabbitmq-server
         | 
| 19 | 
            -
             | 
| 20 | 
            -
            COPY docker-entrypoint.sh /
         | 
| 21 | 
            -
             | 
| 22 | 
            -
            ENTRYPOINT /docker-entrypoint.sh
         | 
| 23 | 
            -
             | 
| 24 | 
            -
            EXPOSE 5671 5672 15672
         | 
    
        data/docker/docker-entrypoint.sh
    DELETED
    
    | @@ -1,26 +0,0 @@ | |
| 1 | 
            -
            #!/bin/sh
         | 
| 2 | 
            -
            server=rabbitmq-server
         | 
| 3 | 
            -
            ctl=rabbitmqctl
         | 
| 4 | 
            -
            delay=5
         | 
| 5 | 
            -
             | 
| 6 | 
            -
            echo 'Starting a RabbitMQ node'
         | 
| 7 | 
            -
            $server -detached
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            echo "Waiting for RabbitMQ to finish startup..."
         | 
| 10 | 
            -
             | 
| 11 | 
            -
            $ctl await_startup --timeout 15
         | 
| 12 | 
            -
             | 
| 13 | 
            -
            $ctl add_user bunny_gem bunny_password
         | 
| 14 | 
            -
            $ctl add_user bunny_reader reader_password
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            $ctl add_vhost bunny_testbed
         | 
| 17 | 
            -
             | 
| 18 | 
            -
            $ctl set_permissions -p / guest '.*' '.*' '.*'
         | 
| 19 | 
            -
            $ctl set_permissions -p bunny_testbed bunny_gem '.*' '.*' '.*'
         | 
| 20 | 
            -
            $ctl set_permissions -p bunny_testbed guest '.*' '.*' '.*'
         | 
| 21 | 
            -
            $ctl set_permissions -p bunny_testbed bunny_reader '^---$' '^---$' '.*'
         | 
| 22 | 
            -
             | 
| 23 | 
            -
            $ctl shutdown --timeout 10
         | 
| 24 | 
            -
             | 
| 25 | 
            -
            echo 'Starting a RabbitMQ node in foreground (use Ctrl-C to stop)'
         | 
| 26 | 
            -
            exec $server
         | 
    
        data/docker/rabbitmq.conf
    DELETED
    
    | @@ -1,29 +0,0 @@ | |
| 1 | 
            -
            listeners.tcp.1 = 0.0.0.0:5672
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            listeners.ssl.default = 5671
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            ssl_options.cacertfile = /spec/tls/ca_certificate.pem
         | 
| 6 | 
            -
            ssl_options.certfile   = /spec/tls/server_certificate.pem
         | 
| 7 | 
            -
            ssl_options.keyfile    = /spec/tls/server_key.pem
         | 
| 8 | 
            -
            ssl_options.verify               = verify_none
         | 
| 9 | 
            -
            ssl_options.fail_if_no_peer_cert = false
         | 
| 10 | 
            -
             | 
| 11 | 
            -
            ssl_options.honor_cipher_order   = true
         | 
| 12 | 
            -
            ssl_options.honor_ecc_order      = true
         | 
| 13 | 
            -
            ssl_options.client_renegotiation = false
         | 
| 14 | 
            -
            ssl_options.secure_renegotiate   = true
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            ssl_options.ciphers.1  = ECDHE-ECDSA-AES256-GCM-SHA384
         | 
| 17 | 
            -
            ssl_options.ciphers.2  = ECDHE-RSA-AES256-GCM-SHA384
         | 
| 18 | 
            -
            ssl_options.ciphers.3  = ECDH-ECDSA-AES256-GCM-SHA384
         | 
| 19 | 
            -
            ssl_options.ciphers.4  = ECDH-RSA-AES256-GCM-SHA384
         | 
| 20 | 
            -
            ssl_options.ciphers.5  = DHE-RSA-AES256-GCM-SHA384
         | 
| 21 | 
            -
            ssl_options.ciphers.6  = DHE-DSS-AES256-GCM-SHA384
         | 
| 22 | 
            -
            ssl_options.ciphers.7  = ECDHE-ECDSA-AES128-GCM-SHA256
         | 
| 23 | 
            -
            ssl_options.ciphers.8  = ECDHE-RSA-AES128-GCM-SHA256
         | 
| 24 | 
            -
            ssl_options.ciphers.9  = ECDH-ECDSA-AES128-GCM-SHA256
         | 
| 25 | 
            -
            ssl_options.ciphers.10 = ECDH-RSA-AES128-GCM-SHA256
         | 
| 26 | 
            -
            ssl_options.ciphers.11 = DHE-RSA-AES128-GCM-SHA256
         | 
| 27 | 
            -
            ssl_options.ciphers.12 = DHE-DSS-AES128-GCM-SHA256
         | 
| 28 | 
            -
             | 
| 29 | 
            -
            loopback_users = none
         |