commit rubygem-bunny for openSUSE:Factory
![](https://seccdn.libravatar.org/avatar/e2145bc5cf53dda95c308a3c75e8fef3.jpg?s=120&d=mm&r=g)
Hello community, here is the log from the commit of package rubygem-bunny for openSUSE:Factory checked in at 2016-04-28 16:53:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-bunny (Old) and /work/SRC/openSUSE:Factory/.rubygem-bunny.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "rubygem-bunny" Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-bunny/rubygem-bunny.changes 2015-12-03 13:30:05.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.rubygem-bunny.new/rubygem-bunny.changes 2016-04-28 16:56:40.000000000 +0200 @@ -1,0 +2,42 @@ +Wed Apr 6 06:13:09 UTC 2016 - coolo@suse.com + +- updated to version 2.3.1 + see installed ChangeLog.md + + ## Changes between Bunny 2.3.0 and 2.3.1 (Apr 4th, 2016) + + ### Support (Quoted) IPv6 Addresses in Address Lists + + GitHub issue: [#383](https://github.com/ruby-amqp/bunny/issues/383). + + Contributed by Jeremy Heiler. + + ### Transport#read_fully Doesn't Try to Recover + + Since transport is replaced by a recovering connection + anyway, and this produces confusing errors up the stack. + + GitHub issue: [#359](https://github.com/ruby-amqp/bunny/issues/359) + + Contributed by Donal McBreen. + +------------------------------------------------------------------- +Sat Feb 27 05:31:02 UTC 2016 - coolo@suse.com + +- updated to version 2.3.0 + see installed ChangeLog.md + +------------------------------------------------------------------- +Fri Dec 18 05:29:55 UTC 2015 - coolo@suse.com + +- updated to version 2.2.2 + see installed ChangeLog.md + + ## Changes between Bunny 2.2.1 and 2.2.2 + + ### amq-protocol Update + + Minimum `amq-protocol` version is now `2.0.1` which includes + bug fixes. + +------------------------------------------------------------------- Old: ---- bunny-2.2.1.gem New: ---- bunny-2.3.1.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-bunny.spec ++++++ --- /var/tmp/diff_new_pack.hrjiiv/_old 2016-04-28 16:56:41.000000000 +0200 +++ /var/tmp/diff_new_pack.hrjiiv/_new 2016-04-28 16:56:41.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package rubygem-bunny # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,7 +24,7 @@ # Name: rubygem-bunny -Version: 2.2.1 +Version: 2.3.1 Release: 0 %define mod_name bunny %define mod_full_name %{mod_name}-%{version} ++++++ bunny-2.2.1.gem -> bunny-2.3.1.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.travis.yml new/.travis.yml --- old/.travis.yml 2015-11-01 20:46:43.000000000 +0100 +++ new/.travis.yml 2016-04-04 12:45:42.000000000 +0200 @@ -1,13 +1,11 @@ language: ruby bundler_args: --without development +cache: bundler before_script: "./bin/ci/before_build" script: "bundle exec rspec -cf documentation spec" rvm: - - "2.2" - - "2.1" - - "2.0" - - "jruby" - - "rbx" + - "2.3.0" + - "2.2.2" notifications: email: michael@rabbitmq.com services: @@ -15,8 +13,3 @@ branches: only: - master - - 1.4.x-stable -matrix: - allow_failures: - - rvm: rbx - - rvm: jruby diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ChangeLog.md new/ChangeLog.md --- old/ChangeLog.md 2015-11-01 20:46:43.000000000 +0100 +++ new/ChangeLog.md 2016-04-04 12:45:42.000000000 +0200 @@ -1,4 +1,40 @@ -## Changes between Bunny 2.2.0 and 2.2.1 +## Changes between Bunny 2.3.0 and 2.3.1 (Apr 4th, 2016) + +### Support (Quoted) IPv6 Addresses in Address Lists + +GitHub issue: [#383](https://github.com/ruby-amqp/bunny/issues/383). + +Contributed by Jeremy Heiler. + +### Transport#read_fully Doesn't Try to Recover + +Since transport is replaced by a recovering connection +anyway, and this produces confusing errors up the stack. + +GitHub issue: [#359](https://github.com/ruby-amqp/bunny/issues/359) + +Contributed by Donal McBreen. + + + +## Changes between Bunny 2.2.0 and 2.3.0 (Feb 26th, 2016) + +### Thread#abort_on_exception Setting for Consumer Work Pool Threads + +`Bunny::Session#create_channel` now supports a 3rd argument that, +when set to `true`, makes consumer work pool threads to have +`Thread#abort_on_exception` set on them. + +Contributed by Seamus Abshere. + +### Explicit Transport Closure on Recovery + +Bunny now will explicitly close previosly used transport before starting +connection recovery. + +GitHub issue: [#377](https://github.com/ruby-amqp/bunny/pull/377). + +Contributed by bkanhoopla. ### No TLS Socket Double-init @@ -8,9 +44,15 @@ Contributed by Carl Hörberg. +### Lazily Evaluated Debug Log Strings + +GH issue: [#375](https://github.com/ruby-amqp/bunny/pull/375) +Contributed by Omer Katz. -## Changes between Bunny 2.1.0 and 2.2.0 + + +## Changes between Bunny 2.1.0 and 2.2.0 (Sep 6th, 2015) ### Add :addresses to connect options @@ -18,6 +60,8 @@ address is a combination of a host and a port. This makes it possible to specify different hosts with different ports. +Contributed by Bart van Zon (Tele2). + ### Recover from connection.close by default Bunny will now try to reconnect also when server sent connection.close is @@ -25,6 +69,9 @@ force closed by the server). This is in-line with how many other clients behave. The old default was `recover_from_connection_close: false`. +Contributed by Carl Hörberg (CloudAMQP). + + ## Changes between Bunny 2.0.0 and 2.1.0 Bunny 2.1.0 has an **important breaking change**. It is highly diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Gemfile new/Gemfile --- old/Gemfile 2015-11-01 20:46:43.000000000 +0100 +++ new/Gemfile 2016-04-04 12:45:42.000000000 +0200 @@ -32,8 +32,8 @@ end group :test do - gem "rspec", "~> 3.2.0" - gem "rabbitmq_http_api_client", "~> 1.2.0" + gem "rspec", "~> 3.4.0" + gem "rabbitmq_http_api_client", "~> 1.6.0" end gemspec diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/LICENSE new/LICENSE --- old/LICENSE 2015-11-01 20:46:43.000000000 +0100 +++ new/LICENSE 2016-04-04 12:45:42.000000000 +0200 @@ -1,4 +1,4 @@ -Copyright (c) 2009 – 2015 Chris Duncan, Jakub Stastny aka botanicus, +Copyright (c) 2009 – 2016 Chris Duncan, Jakub Stastny aka botanicus, Michael S. Klishin, Eric Lindvall, Stefan Kaes and contributors. Permission is hereby granted, free of charge, to any person obtaining diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2015-11-01 20:46:43.000000000 +0100 +++ new/README.md 2016-04-04 12:45:42.000000000 +0200 @@ -51,7 +51,7 @@ * CRuby 2.2, 2.1, 2.0 Bunny works sufficiently well on JRuby but there are known -JRuby bugs that cause high CPU burn. JRuby users should +JRuby bugs in versions prior to JRuby 9000 that cause high CPU burn. JRuby users should use [March Hare](http://rubymarchhare.info). Bunny `1.7.x` was the last version to support CRuby 1.9.3 and 1.8.7 @@ -88,7 +88,7 @@ To use Bunny in a project managed with Bundler: ``` ruby -gem "bunny", ">= 2.1.0" +gem "bunny", ">= 2.2.2" ``` @@ -158,9 +158,9 @@ to also join the [RabbitMQ mailing list](https://groups.google.com/forum/#!forum/rabbitmq-users) mailing list. Feel free to ask any questions that you may have. -### IRC +## Continuous Integration -For more immediate help, please join `#rabbitmq` on `irc.freenode.net`. +[![Build Status](https://travis-ci.org/ruby-amqp/bunny.png)](https://travis-ci.org/ruby-amqp/bunny/) ### News & Announcements on Twitter diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bin/ci/before_build new/bin/ci/before_build --- old/bin/ci/before_build 2015-11-01 20:46:43.000000000 +0100 +++ new/bin/ci/before_build 2016-04-04 12:45:42.000000000 +0200 @@ -1,11 +1,10 @@ #!/usr/bin/env ruby -$nodename = ENV.fetch("RABBITMQ_NODENAME", "rabbit") $ctl = ENV.fetch("RABBITMQCTL", "sudo rabbitmqctl") $plugins = ENV.fetch("RABBITMQ_PLUGINS", "sudo rabbitmq-plugins") def rabbit_control(args) - command = "#{$ctl} -n #{$nodename} #{args}" + command = "#{$ctl} #{args}" system command end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bunny.gemspec new/bunny.gemspec --- old/bunny.gemspec 2015-11-01 20:46:43.000000000 +0100 +++ new/bunny.gemspec 2016-04-04 12:45:42.000000000 +0200 @@ -24,7 +24,7 @@ s.email = ["michael.s.klishin@gmail.com"] # Dependencies - s.add_dependency "amq-protocol", ">= 2.0.0" + s.add_dependency "amq-protocol", ">= 2.0.1" # Files. s.has_rdoc = true Files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/connection/channel_level_exception.rb new/examples/connection/channel_level_exception.rb --- old/examples/connection/channel_level_exception.rb 2015-11-01 20:46:43.000000000 +0100 +++ new/examples/connection/channel_level_exception.rb 2016-04-04 12:45:42.000000000 +0200 @@ -12,14 +12,6 @@ conn.start begin - ch1 = conn.create_channel - ch1.queue_delete("queue_that_should_not_exist#{rand}") -rescue Bunny::NotFound => e - puts "Channel-level exception! Code: #{e.channel_close.reply_code}, message: #{e.channel_close.reply_text}" -end - - -begin ch2 = conn.create_channel q = "bunny.examples.recovery.q#{rand}" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/guides/extensions/alternate_exchange.rb new/examples/guides/extensions/alternate_exchange.rb --- old/examples/guides/extensions/alternate_exchange.rb 2015-11-01 20:46:43.000000000 +0100 +++ new/examples/guides/extensions/alternate_exchange.rb 2016-04-04 12:45:42.000000000 +0200 @@ -4,6 +4,8 @@ require "rubygems" require "bunny" +STDOUT.sync = true + puts "=> Demonstrating alternate exchanges" puts diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/guides/getting_started/hello_world.rb new/examples/guides/getting_started/hello_world.rb --- old/examples/guides/getting_started/hello_world.rb 2015-11-01 20:46:43.000000000 +0100 +++ new/examples/guides/getting_started/hello_world.rb 2016-04-04 12:45:42.000000000 +0200 @@ -4,6 +4,8 @@ require "rubygems" require "bunny" +STDOUT.sync = true + conn = Bunny.new conn.start diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/guides/getting_started/weathr.rb new/examples/guides/getting_started/weathr.rb --- old/examples/guides/getting_started/weathr.rb 2015-11-01 20:46:43.000000000 +0100 +++ new/examples/guides/getting_started/weathr.rb 2016-04-04 12:45:42.000000000 +0200 @@ -4,6 +4,8 @@ require "rubygems" require "bunny" +STDOUT.sync = true + connection = Bunny.new connection.start diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/guides/queues/one_off_consumer.rb new/examples/guides/queues/one_off_consumer.rb --- old/examples/guides/queues/one_off_consumer.rb 2015-11-01 20:46:43.000000000 +0100 +++ new/examples/guides/queues/one_off_consumer.rb 2016-04-04 12:45:42.000000000 +0200 @@ -4,6 +4,8 @@ require "rubygems" require "bunny" +STDOUT.sync = true + conn = Bunny.new conn.start diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/guides/queues/redeliveries.rb new/examples/guides/queues/redeliveries.rb --- old/examples/guides/queues/redeliveries.rb 2015-11-01 20:46:43.000000000 +0100 +++ new/examples/guides/queues/redeliveries.rb 2016-04-04 12:45:42.000000000 +0200 @@ -4,6 +4,8 @@ require "rubygems" require "bunny" +STDOUT.sync = true + puts "=> Subscribing for messages using explicit acknowledgements model" puts diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/bunny/channel.rb new/lib/bunny/channel.rb --- old/lib/bunny/channel.rb 2015-11-01 20:46:43.000000000 +0100 +++ new/lib/bunny/channel.rb 2016-04-04 12:45:42.000000000 +0200 @@ -618,14 +618,14 @@ # implementation (and even more correct and convenient ones, such as wait/notify, should # we implement them). So we return a triple of nils immediately which apps should be # able to handle anyway as "got no message, no need to act". MK. - @last_basic_get_response = if @connection.open? - wait_on_basic_get_continuations - else - [nil, nil, nil] - end + last_basic_get_response = if @connection.open? + wait_on_basic_get_continuations + else + [nil, nil, nil] + end raise_if_continuation_resulted_in_a_channel_error! - @last_basic_get_response + last_basic_get_response end # prefetch_count is of type short in the protocol. MK. @@ -705,7 +705,7 @@ # # ch = conn.create_channel # q.subscribe do |delivery_info, properties, payload| - # # requeue the message + # # reject the message # ch.basic_reject(delivery_info.delivery_tag, false) # end # @@ -1415,7 +1415,6 @@ Bunny::Timeout.timeout(wait_on_continuations_timeout, ClientTimeout) do @last_confirm_select_ok = wait_on_continuations end - @confirm_mode = true raise_if_continuation_resulted_in_a_channel_error! @last_confirm_select_ok end @@ -1488,7 +1487,7 @@ # # @api plugin def recover_from_network_failure - @logger.debug "Recovering channel #{@id} after network failure" + @logger.debug { "Recovering channel #{@id} after network failure" } release_all_continuations recover_prefetch_setting @@ -1544,7 +1543,7 @@ # @api plugin def recover_queues @queues.values.dup.each do |q| - @logger.debug "Recovering queue #{q.name}" + @logger.debug { "Recovering queue #{q.name}" } q.recover_from_network_failure end end @@ -1555,7 +1554,7 @@ # @api plugin def recover_consumers unless @consumers.empty? - @work_pool = ConsumerWorkPool.new(@work_pool.size) + @work_pool = ConsumerWorkPool.new(@work_pool.size, @work_pool.abort_on_exception) @work_pool.start end @consumers.values.dup.each do |c| @@ -1616,7 +1615,7 @@ # @private def handle_method(method) - @logger.debug "Channel#handle_frame on channel #{@id}: #{method.inspect}" + @logger.debug { "Channel#handle_frame on channel #{@id}: #{method.inspect}" } case method when AMQ::Protocol::Queue::DeclareOk then @continuations.push(method) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/bunny/consumer_work_pool.rb new/lib/bunny/consumer_work_pool.rb --- old/lib/bunny/consumer_work_pool.rb 2015-11-01 20:46:43.000000000 +0100 +++ new/lib/bunny/consumer_work_pool.rb 2016-04-04 12:45:42.000000000 +0200 @@ -15,9 +15,11 @@ attr_reader :threads attr_reader :size + attr_reader :abort_on_exception - def initialize(size = 1) + def initialize(size = 1, abort_on_exception = false) @size = size + @abort_on_exception = abort_on_exception @queue = ::Queue.new @paused = false end @@ -32,6 +34,7 @@ @size.times do t = Thread.new(&method(:run_loop)) + t.abort_on_exception = true if abort_on_exception @threads << t end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/bunny/exceptions.rb new/lib/bunny/exceptions.rb --- old/lib/bunny/exceptions.rb 2015-11-01 20:46:43.000000000 +0100 +++ new/lib/bunny/exceptions.rb 2016-04-04 12:45:42.000000000 +0200 @@ -69,7 +69,7 @@ m = case e when String then e - when Exception then + when ::Exception then e.message end if hostname && port diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/bunny/get_response.rb new/lib/bunny/get_response.rb --- old/lib/bunny/get_response.rb 2015-11-01 20:46:43.000000000 +0100 +++ new/lib/bunny/get_response.rb 2016-04-04 12:45:42.000000000 +0200 @@ -20,7 +20,7 @@ attr_reader :channel # @private - def initialize(get_ok, consumer, channel) + def initialize(get_ok, channel) @get_ok = get_ok @hash = { :delivery_tag => @get_ok.delivery_tag, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/bunny/heartbeat_sender.rb new/lib/bunny/heartbeat_sender.rb --- old/lib/bunny/heartbeat_sender.rb 2015-11-01 20:46:43.000000000 +0100 +++ new/lib/bunny/heartbeat_sender.rb 2016-04-04 12:45:42.000000000 +0200 @@ -62,7 +62,7 @@ now = Time.now if now > (@last_activity_time + @interval) - @logger.debug "Sending a heartbeat, last activity time: #{@last_activity_time}, interval (s): #{@interval}" + @logger.debug { "Sending a heartbeat, last activity time: #{@last_activity_time}, interval (s): #{@interval}" } @transport.write_without_timeout(AMQ::Protocol::HeartbeatFrame.encode) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/bunny/queue.rb new/lib/bunny/queue.rb --- old/lib/bunny/queue.rb 2015-11-01 20:46:43.000000000 +0100 +++ new/lib/bunny/queue.rb 2016-04-04 12:45:42.000000000 +0200 @@ -250,7 +250,7 @@ if block if properties - di = GetResponse.new(get_response, properties, @channel) + di = GetResponse.new(get_response, @channel) mp = MessageProperties.new(properties) block.call(di, mp, content) @@ -259,7 +259,7 @@ end else if properties - di = GetResponse.new(get_response, properties, @channel) + di = GetResponse.new(get_response, @channel) mp = MessageProperties.new(properties) [di, mp, content] else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/bunny/reader_loop.rb new/lib/bunny/reader_loop.rb --- old/lib/bunny/reader_loop.rb 2015-11-01 20:46:43.000000000 +0100 +++ new/lib/bunny/reader_loop.rb 2016-04-04 12:45:42.000000000 +0200 @@ -33,7 +33,7 @@ begin break if @mutex.synchronize { @stopping || @stopped || @network_is_down } run_once - rescue AMQ::Protocol::EmptyResponseError, IOError, SystemCallError => e + rescue AMQ::Protocol::EmptyResponseError, IOError, SystemCallError, Timeout::Error => e break if terminate? || @session.closing? || @session.closed? log_exception(e) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/bunny/session.rb new/lib/bunny/session.rb --- old/lib/bunny/session.rb 2015-11-01 20:46:43.000000000 +0100 +++ new/lib/bunny/session.rb 2016-04-04 12:45:42.000000000 +0200 @@ -86,8 +86,9 @@ attr_reader :mechanism # @return [Logger] attr_reader :logger - # @return [Integer] Timeout for blocking protocol operations (queue.declare, queue.bind, etc), in milliseconds. Default is 4000. + # @return [Integer] Timeout for blocking protocol operations (queue.declare, queue.bind, etc), in milliseconds. Default is 15000. attr_reader :continuation_timeout + attr_reader :network_recovery_interval # @param [String, Hash] connection_string_or_opts Connection string or a hash of connection options @@ -107,7 +108,7 @@ # @option connection_string_or_opts [String] :tls_key (nil) Path to client TLS/SSL private key file (.pem) # @option connection_string_or_opts [Array<String>] :tls_ca_certificates Array of paths to TLS/SSL CA files (.pem), by default detected from OpenSSL configuration # @option connection_string_or_opts [String] :verify_peer (true) Whether TLS peer verification should be performed - # @option connection_string_or_opts [Integer] :continuation_timeout (4000) Timeout for client operations that expect a response (e.g. {Bunny::Queue#get}), in milliseconds. + # @option connection_string_or_opts [Integer] :continuation_timeout (15000) Timeout for client operations that expect a response (e.g. {Bunny::Queue#get}), in milliseconds. # @option connection_string_or_opts [Integer] :connection_timeout (5) Timeout in seconds for connecting to the server. # @option connection_string_or_opts [Proc] :hosts_shuffle_strategy A Proc that reorders a list of host strings, defaults to Array#shuffle # @option connection_string_or_opts [Logger] :logger The logger. If missing, one is created using :log_file and :log_level. @@ -137,18 +138,23 @@ @default_hosts_shuffle_strategy = Proc.new { |hosts| hosts.shuffle } @opts = opts + log_file = opts[:log_file] || opts[:logfile] || STDOUT + log_level = opts[:log_level] || ENV["BUNNY_LOG_LEVEL"] || Logger::WARN + # we might need to log a warning about ill-formatted IPv6 address but + # progname includes hostname, so init like this first + @logger = opts.fetch(:logger, init_default_logger_without_progname(log_file, log_level)) + @addresses = self.addresses_from(opts) @address_index = 0 + # re-init, see above + @logger = opts.fetch(:logger, init_default_logger(log_file, log_level)) + @user = self.username_from(opts) @pass = self.password_from(opts) @vhost = self.vhost_from(opts) @threaded = opts.fetch(:threaded, true) - log_file = opts[:log_file] || opts[:logfile] || STDOUT - log_level = opts[:log_level] || ENV["BUNNY_LOG_LEVEL"] || Logger::WARN - @logger = opts.fetch(:logger, init_default_logger(log_file, log_level)) - validate_connection_options(opts) # should automatic recovery from network failures be used? @@ -330,14 +336,14 @@ # opened (this operation is very fast and inexpensive). # # @return [Bunny::Channel] Newly opened channel - def create_channel(n = nil, consumer_pool_size = 1) + def create_channel(n = nil, consumer_pool_size = 1, consumer_pool_abort_on_exception = false) raise ArgumentError, "channel number 0 is reserved in the protocol and cannot be used" if 0 == n @channel_mutex.synchronize do if n && (ch = @channels[n]) ch else - ch = Bunny::Channel.new(self, n, ConsumerWorkPool.new(consumer_pool_size || 1)) + ch = Bunny::Channel.new(self, n, ConsumerWorkPool.new(consumer_pool_size || 1, consumer_pool_abort_on_exception)) ch.open ch end @@ -547,7 +553,7 @@ # # @private def handle_frame(ch_number, method) - @logger.debug "Session#handle_frame on #{ch_number}: #{method.inspect}" + @logger.debug { "Session#handle_frame on #{ch_number}: #{method.inspect}" } case method when AMQ::Protocol::Channel::OpenOk then @continuations.push(method) @@ -636,6 +642,7 @@ @channels.each do |n, ch| ch.maybe_kill_consumer_work_pool! end + @reader_loop.stop if @reader_loop maybe_shutdown_heartbeat_sender recover_from_network_failure @@ -695,9 +702,6 @@ # @private def recover_channels - # default channel is reopened right after connection - # negotiation is completed, so make sure we do not try to open - # it twice. MK. @channels.each do |n, ch| ch.open @@ -776,11 +780,6 @@ end # @private - def host_with_port?(address) - address.include? ':' - end - - # @private def port_from(options) fallback = if options[:tls] || options[:ssl] AMQ::Protocol::TLS_PORT @@ -792,13 +791,60 @@ end # @private + def host_with_port?(address) + # we need to handle cases such as [2001:db8:85a3:8d3:1319:8a2e:370:7348]:5671 + last_colon = address.rindex(":") + last_closing_square_bracket = address.rindex("]") + + if last_closing_square_bracket.nil? + address.include?(":") + else + last_closing_square_bracket < last_colon + end + end + + # @private def host_from_address(address) - address.split(":")[0] + # we need to handle cases such as [2001:db8:85a3:8d3:1319:8a2e:370:7348]:5671 + last_colon = address.rindex(":") + last_closing_square_bracket = address.rindex("]") + + if last_closing_square_bracket.nil? + parts = address.split(":") + # this looks like an unquoted IPv6 address, so emit a warning + if parts.size > 2 + @logger.warn "Address #{address} looks like an unquoted IPv6 address. Make sure you quote IPv6 addresses like so: [2001:db8:85a3:8d3:1319:8a2e:370:7348]" + end + return parts[0] + end + + if last_closing_square_bracket < last_colon + # there is a port + address[0, last_colon] + elsif last_closing_square_bracket > last_colon + address + end end # @private def port_from_address(address) - address.split(":")[1].to_i + # we need to handle cases such as [2001:db8:85a3:8d3:1319:8a2e:370:7348]:5671 + last_colon = address.rindex(":") + last_closing_square_bracket = address.rindex("]") + + if last_closing_square_bracket.nil? + parts = address.split(":") + # this looks like an unquoted IPv6 address, so emit a warning + if parts.size > 2 + @logger.warn "Address #{address} looks like an unquoted IPv6 address. Make sure you quote IPv6 addresses like so: [2001:db8:85a3:8d3:1319:8a2e:370:7348]" + end + return parts[1].to_i + end + + if last_closing_square_bracket < last_colon + # there is a port + address[(last_colon + 1)..-1].to_i + end end # @private @@ -934,7 +980,7 @@ end end - # Sends multiple frames, one by one. For thread safety this method takes a channel + # Sends multiple frames, in one go. For thread safety this method takes a channel # object and synchronizes on it. # # @private @@ -1049,7 +1095,7 @@ else negotiate_value(@client_heartbeat, connection_tune.heartbeat) end - @logger.debug "Heartbeat interval negotiation: client = #{@client_heartbeat}, server = #{connection_tune.heartbeat}, result = #{@heartbeat}" + @logger.debug { "Heartbeat interval negotiation: client = #{@client_heartbeat}, server = #{connection_tune.heartbeat}, result = #{@heartbeat}" } @logger.info "Heartbeat interval used (in seconds): #{@heartbeat}" # We set the read_write_timeout to twice the heartbeat value @@ -1069,9 +1115,9 @@ end @transport.send_frame(AMQ::Protocol::Connection::TuneOk.encode(@channel_max, @frame_max, @heartbeat)) - @logger.debug "Sent connection.tune-ok with heartbeat interval = #{@heartbeat}, frame_max = #{@frame_max}, channel_max = #{@channel_max}" + @logger.debug { "Sent connection.tune-ok with heartbeat interval = #{@heartbeat}, frame_max = #{@frame_max}, channel_max = #{@channel_max}" } @transport.send_frame(AMQ::Protocol::Connection::Open.encode(self.vhost)) - @logger.debug "Sent connection.open with vhost = #{self.vhost}" + @logger.debug { "Sent connection.open with vhost = #{self.vhost}" } frame2 = begin fr = @transport.read_next_frame @@ -1220,6 +1266,15 @@ lgr end end + + # @private + def init_default_logger_without_progname(logfile, level) + @default_logger = begin + lgr = ::Logger.new(logfile) + lgr.level = normalize_log_level(level) + lgr + end + end # @private def normalize_log_level(level) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/bunny/transport.rb new/lib/bunny/transport.rb --- old/lib/bunny/transport.rb 2015-11-01 20:46:43.000000000 +0100 +++ new/lib/bunny/transport.rb 2016-04-04 12:45:42.000000000 +0200 @@ -218,7 +218,7 @@ @status = :not_connected if @session.automatically_recover? - @session.handle_network_failure(e) + raise else @session_thread.raise(Bunny::NetworkFailure.new("detected a network failure: #{e.message}", e)) end @@ -458,8 +458,8 @@ cert_inlines.push(cert) end end - @logger.debug "Using CA certificates at #{cert_files.join(', ')}" - @logger.debug "Using #{cert_inlines.count} inline CA certificates" + @logger.debug { "Using CA certificates at #{cert_files.join(', ')}" } + @logger.debug { "Using #{cert_inlines.count} inline CA certificates" } if certs.empty? @logger.error "No CA certificates found, add one with :tls_ca_certificates" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/bunny/version.rb new/lib/bunny/version.rb --- old/lib/bunny/version.rb 2015-11-01 20:46:43.000000000 +0100 +++ new/lib/bunny/version.rb 2016-04-04 12:45:42.000000000 +0200 @@ -2,5 +2,5 @@ module Bunny # @return [String] Version of the library - VERSION = "2.2.1" + VERSION = "2.3.1" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2015-11-01 20:46:43.000000000 +0100 +++ new/metadata 2016-04-04 12:45:42.000000000 +0200 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: bunny version: !ruby/object:Gem::Version - version: 2.2.1 + version: 2.3.1 platform: ruby authors: - Chris Duncan @@ -12,7 +12,7 @@ autorequire: bindir: bin cert_chain: [] -date: 2015-11-01 00:00:00.000000000 Z +date: 2016-04-04 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: amq-protocol @@ -20,14 +20,14 @@ requirements: - - ">=" - !ruby/object:Gem::Version - version: 2.0.0 + version: 2.0.1 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version - version: 2.0.0 + version: 2.0.1 description: Easy to use, feature complete Ruby client for RabbitMQ 3.3 and later versions. email: @@ -228,7 +228,7 @@ version: '0' requirements: [] rubyforge_project: -rubygems_version: 2.4.8 +rubygems_version: 2.5.1 signing_key: specification_version: 4 summary: Popular easy to use Ruby client for RabbitMQ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/higher_level_api/integration/basic_consume_spec.rb new/spec/higher_level_api/integration/basic_consume_spec.rb --- old/spec/higher_level_api/integration/basic_consume_spec.rb 2015-11-01 20:46:43.000000000 +0100 +++ new/spec/higher_level_api/integration/basic_consume_spec.rb 2016-04-04 12:45:42.000000000 +0200 @@ -260,7 +260,10 @@ let(:queue_name) { "bunny.basic_consume#{rand}" } it "uses exception handler" do + caughts = [] t = Thread.new do + allow(connection.logger).to receive(:error) { |x| caughts << x } + ch = connection.create_channel q = ch.queue(queue_name, :auto_delete => true, :durable => false) @@ -276,6 +279,8 @@ 5.times { x.publish("hello", :routing_key => queue_name) } sleep 1.5 + expect(caughts.size).to eq(5) + ch.close end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/higher_level_api/integration/connection_recovery_spec.rb new/spec/higher_level_api/integration/connection_recovery_spec.rb --- old/spec/higher_level_api/integration/connection_recovery_spec.rb 2015-11-01 20:46:43.000000000 +0100 +++ new/spec/higher_level_api/integration/connection_recovery_spec.rb 2016-04-04 12:45:42.000000000 +0200 @@ -63,27 +63,34 @@ end def ensure_queue_recovery(ch, q) + ch.confirm_select q.purge x = ch.default_exchange x.publish("msg", :routing_key => q.name) + ch.wait_for_confirms sleep 0.5 expect(q.message_count).to eq 1 q.purge end - def ensure_queue_binding_recovery(x, q, routing_key = "") + def ensure_queue_binding_recovery(ch, x, q, routing_key = "") + ch.confirm_select q.purge x.publish("msg", :routing_key => routing_key) + ch.wait_for_confirms sleep 0.5 expect(q.message_count).to eq 1 q.purge end def ensure_exchange_binding_recovery(ch, source, destination, routing_key = "") + ch.confirm_select q = ch.queue("", :exclusive => true) q.bind(destination, :routing_key => routing_key) source.publish("msg", :routing_key => routing_key) + ch.wait_for_confirms + sleep 0.5 expect(q.message_count).to eq 1 q.delete end @@ -273,7 +280,7 @@ wait_for_recovery expect(ch).to be_open - ensure_queue_binding_recovery(x, q) + ensure_queue_binding_recovery(ch, x, q) end end @@ -352,6 +359,7 @@ expect(c).not_to be_open wait_for_recovery + sleep 1 expect(ch).to be_open expect(q.consumer_count).to eq n @@ -374,6 +382,7 @@ expect(c).not_to be_open wait_for_recovery + sleep 1 expect(ch).to be_open qs.each do |q| diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/higher_level_api/integration/connection_spec.rb new/spec/higher_level_api/integration/connection_spec.rb --- old/spec/higher_level_api/integration/connection_spec.rb 2015-11-01 20:46:43.000000000 +0100 +++ new/spec/higher_level_api/integration/connection_spec.rb 2016-04-04 12:45:42.000000000 +0200 @@ -192,6 +192,83 @@ end end + context "initialized with :addresses => [...] with quoted IPv6 hostnames" do + after :each do + subject.close if subject.open? + end + + let(:host) { "[2001:db8:85a3:8d3:1319:8a2e:370:7348]" } + let(:port) { 5673 } + let(:address) { "#{host}:#{port}" } + let(:addresses) { [address] } + let(:subject) { described_class.new(:addresses => addresses) } + + it "uses correct hostname" do + expect(subject.host).to eq host + expect(subject.hostname).to eq host + end + + it "uses port 5673" do + expect(subject.port).to eq port + end + + it "uses username = guest" do + expect(subject.username).to eq username + expect(subject.user).to eq username + end + end + + context "initialized with :addresses => [...] with quoted IPv6 hostnames without ports" do + after :each do + subject.close if subject.open? + end + + let(:host) { "[2001:db8:85a3:8d3:1319:8a2e:370:7348]" } + let(:address) { host } + let(:addresses) { [address] } + let(:subject) { described_class.new(:addresses => addresses) } + + it "uses correct hostname" do + expect(subject.host).to eq host + expect(subject.hostname).to eq host + end + + it "uses port 5672" do + expect(subject.port).to eq 5672 + end + + it "uses username = guest" do + expect(subject.username).to eq username + expect(subject.user).to eq username + end + end + + context "initialized with :addresses => [...] with an quoted IPv6 hostnames" do + after :each do + subject.close if subject.open? + end + + let(:host) { "2001:db8:85a3:8d3:1319:8a2e:370:7348" } + let(:port) { 5673 } + let(:address) { "#{host}:#{port}" } + let(:addresses) { [address] } + let(:subject) { described_class.new(:addresses => addresses) } + + it "fails to correctly parse the host (and emits a warning)" do + expect(subject.host).to eq "2001" + expect(subject.hostname).to eq "2001" + end + + it "fails to correctly parse the port (and emits a warning)" do + expect(subject.port).to eq 0 + end + + it "uses username = guest" do + expect(subject.username).to eq username + expect(subject.user).to eq username + end + end + context "initialized with conflicting hosts and addresses" do let(:host) { "192.168.1.10" } let(:port) { 5673 } @@ -259,9 +336,9 @@ :password => "bunny_password", :vhost => "bunny_testbed", :tls => true, - :tls_cert => "spec/tls/client_cert.pem", + :tls_cert => "spec/tls/client_certificate.pem", :tls_key => "spec/tls/client_key.pem", - :tls_ca_certificates => ["./spec/tls/cacert.pem"]) + :tls_ca_certificates => ["./spec/tls/ca_certificate.pem"]) end it "uses TLS port" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/higher_level_api/integration/connection_stop_spec.rb new/spec/higher_level_api/integration/connection_stop_spec.rb --- old/spec/higher_level_api/integration/connection_stop_spec.rb 2015-11-01 20:46:43.000000000 +0100 +++ new/spec/higher_level_api/integration/connection_stop_spec.rb 2016-04-04 12:45:42.000000000 +0200 @@ -52,7 +52,7 @@ describe "that recovers from connection.close" do it "can be closed" do - c = Bunny.new(:automatically_recover => false, :recover_from_connection_close => true, :network_recovery_interval => 0.2) + c = Bunny.new(:automatically_recover => true, :recover_from_connection_close => true, :network_recovery_interval => 0.2) c.start ch = c.create_channel diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/higher_level_api/integration/queue_declare_spec.rb new/spec/higher_level_api/integration/queue_declare_spec.rb --- old/spec/higher_level_api/integration/queue_declare_spec.rb 2015-11-01 20:46:43.000000000 +0100 +++ new/spec/higher_level_api/integration/queue_declare_spec.rb 2016-04-04 12:45:42.000000000 +0200 @@ -136,6 +136,34 @@ end + context "when queue is declared with priorities" do + let(:args) do + {"x-max-priority" => 5} + end + + it "enables priority implementation" do + ch = connection.create_channel + ch.confirm_select + + q = ch.queue("bunny.tests.queues.with-arguments.priority", :arguments => args, :exclusive => true) + expect(q.arguments).to eq args + + q.publish("xyzzy") + ch.wait_for_confirms + sleep 0.1 + + # this test only does sanity checking, + # without trying to actually test prioritisation. + # + # added to guard against issues such as + # https://github.com/rabbitmq/rabbitmq-server/issues/488 + expect(q.message_count).to eq 1 + + ch.close + end + end + + describe "#queue_exists?" do context "when a queue exists" do it "returns true" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/higher_level_api/integration/tls_connection_spec.rb new/spec/higher_level_api/integration/tls_connection_spec.rb --- old/spec/higher_level_api/integration/tls_connection_spec.rb 2015-11-01 20:46:43.000000000 +0100 +++ new/spec/higher_level_api/integration/tls_connection_spec.rb 2016-04-04 12:45:42.000000000 +0200 @@ -37,9 +37,9 @@ :password => "bunny_password", :vhost => "bunny_testbed", :tls => true, - :tls_cert => "spec/tls/client_cert.pem", + :tls_cert => "spec/tls/client_certificate.pem", :tls_key => "spec/tls/client_key.pem", - :tls_ca_certificates => ["./spec/tls/cacert.pem"], + :tls_ca_certificates => ["./spec/tls/ca_certificate.pem"], :verify_peer => false) c.start c @@ -59,7 +59,7 @@ :password => "bunny_password", :vhost => "bunny_testbed", :tls => true, - :tls_ca_certificates => ["./spec/tls/cacert.pem"], + :tls_ca_certificates => ["./spec/tls/ca_certificate.pem"], :verify_peer => false) c.start c @@ -76,9 +76,9 @@ describe "TLS connection to RabbitMQ with a connection string" do let(:connection) do c = Bunny.new("amqps://bunny_gem:bunny_password@127.0.0.1/bunny_testbed", - :tls_cert => "spec/tls/client_cert.pem", + :tls_cert => "spec/tls/client_certificate.pem", :tls_key => "spec/tls/client_key.pem", - :tls_ca_certificates => ["./spec/tls/cacert.pem"], + :tls_ca_certificates => ["./spec/tls/ca_certificate.pem"], :verify_peer => false) c.start c @@ -95,7 +95,7 @@ describe "TLS connection to RabbitMQ with a connection string and w/o client certificate and key" do let(:connection) do c = Bunny.new("amqps://bunny_gem:bunny_password@127.0.0.1/bunny_testbed", - :tls_ca_certificates => ["./spec/tls/cacert.pem"], + :tls_ca_certificates => ["./spec/tls/ca_certificate.pem"], :verify_peer => false) c.start c @@ -115,9 +115,9 @@ :password => "bunny_password", :vhost => "bunny_testbed", :tls => true, - :tls_cert => File.read("./spec/tls/client_cert.pem"), + :tls_cert => File.read("./spec/tls/client_certificate.pem"), :tls_key => File.read("./spec/tls/client_key.pem"), - :tls_ca_certificates => ["./spec/tls/cacert.pem"], + :tls_ca_certificates => ["./spec/tls/ca_certificate.pem"], :verify_peer => false) c.start c @@ -137,7 +137,7 @@ :vhost => "bunny_testbed", :tls => true, :tls_protocol => :TLSv1, - :tls_ca_certificates => ["./spec/tls/cacert.pem"], + :tls_ca_certificates => ["./spec/tls/ca_certificate.pem"], :verify_peer => false) c.start c
participants (1)
-
root@hilbert.suse.de