bunny 2.7.4 → 2.8.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 67acdd00ad8e7f36b89bcf6043cca832b5ee9ed8
4
- data.tar.gz: 3fcc3fedbafc611804bf76f0be43e211f8292f75
3
+ metadata.gz: 4233cd136f781586c6c21f3e6abae2052a0aefdf
4
+ data.tar.gz: 359da718cb420fadb31d4f67f9b23557d1d03ddf
5
5
  SHA512:
6
- metadata.gz: f730e0dd7c1777043f3fa31b3316df10bb7d12f880d4d0d48cff481d8ab199f667f5399a4de7a059b61a3ad520739448d12ca7f8eca87b90f6bef897f4ca2add
7
- data.tar.gz: eeff99bc77bb6b95c0c4f84704c699166fd1ca0c29a21c78dde60ca545042f85cf7f5115c58fbc8575f614063ccccd10239ef9bd42a9bb43343e101470679c8d
6
+ metadata.gz: c4c5f6c2ae11023b9fe6a45b66fdb7b97f2aa07b89ba7f39cf6d5a2f2c27c7dce1bdc9e3a303d41c1ef067268247617f9e19618e0ac8b58a846ca1452307c050
7
+ data.tar.gz: df6aeb03ba7a97a8b864d471bf76eccdf29415bf11db84e8ec9034636de65377ecb1e7bdc9cb4475ad944164d714586a5cc144ab52d1539e08f8761f152b2fbe
@@ -1,18 +1,15 @@
1
- ## Changes between Bunny 2.7.4 and 2.7.5 (unreleased)
1
+ ## Changes between Bunny 2.7.0 and 2.8.0 (unreleased)
2
2
 
3
- No changes yet.
3
+ This release has **minor breaking public API changes**.
4
4
 
5
+ ### `Bunny::Channel#close` on a Closed Channel Now Raises a Sensible Exception
5
6
 
6
- ## Changes between Bunny 2.7.3 and 2.7.4 (Jan 9th, 2018)
7
+ `Bunny::Channel#close` on an already closed channel will now raise a sensible exception.
8
+ If the channel was closed due to a channel-level protocol exception, that exception will
9
+ be mentioned.
7
10
 
8
- ### amq-protocol Dependency
9
-
10
- This version depends on amq-protocol `2.2.x`.
11
-
12
- GitHub issue: [#538](https://github.com/ruby-amqp/bunny/issues/538).
13
-
14
-
15
- ## Changes between Bunny 2.7.2 and 2.7.3 (Dec 19th, 2017)
11
+ GitHub issue: [#528](https://github.com/ruby-amqp/bunny/issues/528), see [9df7cb](https://github.com/ruby-amqp/bunny/commit/9df7cb04d9ff12b1af62a11e239fd81e5472c872) for
12
+ details.
16
13
 
17
14
  ### JRuby 9K Compatibility
18
15
 
@@ -20,7 +17,7 @@ A JRuby 9K compatibility issue was corrected by Marian Posăceanu.
20
17
  Note that JRuby users are recommended to use [March Hare](http://rubymarchhare.info/), a JRuby-oriented client, instead
21
18
  of Bunny.
22
19
 
23
- GitHub issue: [#529](https://github.com/ruby-amqp/bunny/pull/529)
20
+ GitHub issue: [bunny#529](https://github.com/ruby-amqp/bunny/pull/529)
24
21
 
25
22
  ### Connection Exceptions are Logged as Warning with Automatic Recovery
26
23
 
@@ -29,26 +26,16 @@ and not errors.
29
26
 
30
27
  Contributed by Merten Falk.
31
28
 
32
- GitHub issue: [#531](https://github.com/ruby-amqp/bunny/pull/531)
33
-
34
-
35
- ## Changes between Bunny 2.7.1 and 2.7.2 (Nov 4th, 2017)
36
-
37
- ### Heartbeat Value Supports `:server` and `"server"`
38
-
39
- Heartbeat value of `:server` now can be specified as a string.
40
-
41
- Contributed by Tyrone.
42
-
29
+ GitHub issue: [bunny#531](https://github.com/ruby-amqp/bunny/pull/531)
43
30
 
44
- ### Reading a Frame without Payload Could Result in a `Bunny::NoFinalOctetError`
31
+ ### Server Heartbeat Value as a String
45
32
 
46
- Reading a frame without payload (e.g. a heartbeat frame) could result in a `Bunny::NoFinalOctetError`
47
- with mostly idle connections.
33
+ It is now possible to specify a server-defined heartbeat value as a string (`"server"`), not just
34
+ a symbol. This makes it easier to load settings from YAML files.
48
35
 
49
- GitHub issue: [#521](https://github.com/ruby-amqp/bunny/issues/521).
36
+ Contributed by Tyrone Wilson.
50
37
 
51
- Contributed by GPif.
38
+ GitHub issue: [bunny#524](https://github.com/ruby-amqp/bunny/pull/524)
52
39
 
53
40
 
54
41
  ## Changes between Bunny 2.7.0 and 2.7.1 (Sep 25th, 2017)
data/Gemfile CHANGED
@@ -50,4 +50,4 @@ def custom_gem(name, options = Hash.new)
50
50
  end
51
51
  end
52
52
 
53
- custom_gem "amq-protocol", "~> 2.2.0"
53
+ custom_gem "amq-protocol", git: "https://github.com/ruby-amqp/amq-protocol", branch: "master"
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
24
24
  s.email = ["michael.s.klishin@gmail.com"]
25
25
 
26
26
  # Dependencies
27
- s.add_dependency "amq-protocol", "~> 2.2.0"
27
+ s.add_dependency "amq-protocol", ">= 2.2.0"
28
28
 
29
29
  # Files.
30
30
  s.has_rdoc = true
@@ -233,6 +233,9 @@ module Bunny
233
233
  # {Bunny::Queue}, {Bunny::Exchange} and {Bunny::Consumer} instances.
234
234
  # @api public
235
235
  def close
236
+ # see bunny#528
237
+ raise_if_no_longer_open!
238
+
236
239
  @connection.close_channel(self)
237
240
  @status = :closed
238
241
  @work_pool.shutdown
@@ -1940,7 +1943,13 @@ module Bunny
1940
1943
 
1941
1944
  # @private
1942
1945
  def raise_if_no_longer_open!
1943
- raise ChannelAlreadyClosed.new("cannot use a channel that was already closed! Channel id: #{@id}", self) if closed?
1946
+ if closed?
1947
+ if @last_channel_error
1948
+ raise ChannelAlreadyClosed.new("cannot use a closed channel! Channel id: #{@id}, closed due to a server-reported channel error: #{@last_channel_error.message}", self)
1949
+ else
1950
+ raise ChannelAlreadyClosed.new("cannot use a closed channel! Channel id: #{@id}", self)
1951
+ end
1952
+ end
1944
1953
  end
1945
1954
 
1946
1955
  # @private
@@ -158,7 +158,9 @@ module Bunny
158
158
  # @option opts [Boolean] :ack (false) [DEPRECATED] Use :manual_ack instead
159
159
  # @option opts [Boolean] :manual_ack (false) Will this consumer use manual acknowledgements?
160
160
  # @option opts [Boolean] :exclusive (false) Should this consumer be exclusive for this queue?
161
- # @option opts [Boolean] :block (false) Should the call block calling thread?
161
+ # @option opts [Boolean] :block (false) Should the call block the calling thread? This option can be useful for keeping the main thread of
162
+ # a script alive. It is incompatible with automatic connection recovery
163
+ # and is not generally recommended.
162
164
  # @option opts [#call] :on_cancellation Block to execute when this consumer is cancelled remotely (e.g. via the RabbitMQ Management plugin)
163
165
  # @option opts [String] :consumer_tag Unique consumer identifier. It is usually recommended to let Bunny generate it for you.
164
166
  # @option opts [Hash] :arguments ({}) Additional (optional) arguments, typically used by RabbitMQ extensions
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Bunny
4
4
  # @return [String] Version of the library
5
- VERSION = "2.7.4"
5
+ VERSION = "2.8.0"
6
6
  end
@@ -1,6 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- describe Bunny::Channel, "when closed" do
3
+ describe Bunny::Channel do
4
4
  let(:connection) do
5
5
  c = Bunny.new(username: "bunny_gem", password: "bunny_password", vhost: "bunny_testbed")
6
6
  c.start
@@ -11,15 +11,52 @@ describe Bunny::Channel, "when closed" do
11
11
  connection.close
12
12
  end
13
13
 
14
- it "releases the id" do
15
- ch = connection.create_channel
16
- n = ch.number
14
+ context "when closed" do
15
+ it "releases the id" do
16
+ ch = connection.create_channel
17
+ n = ch.number
17
18
 
18
- expect(ch).to be_open
19
- ch.close
20
- expect(ch).to be_closed
19
+ expect(ch).to be_open
20
+ ch.close
21
+ expect(ch).to be_closed
21
22
 
22
- # a new channel with the same id can be created
23
- connection.create_channel(n)
23
+ # a new channel with the same id can be created
24
+ connection.create_channel(n)
25
+ end
26
+ end
27
+
28
+ context "when double closed" do
29
+ # bunny#528
30
+ it "raises a meaningful exception" do
31
+ ch = connection.create_channel
32
+
33
+ expect(ch).to be_open
34
+ ch.close
35
+ expect(ch).to be_closed
36
+
37
+ expect { ch.close }.to raise_error(Bunny::ChannelAlreadyClosed)
38
+ end
39
+ end
40
+
41
+ context "when double closed after a channel-level protocol exception" do
42
+ # bunny#528
43
+ it "raises a meaningful exception" do
44
+ ch = connection.create_channel
45
+
46
+ s = "bunny-temp-q-#{rand}"
47
+
48
+ expect(ch).to be_open
49
+ ch.queue_declare(s, durable: false, exclusive: true)
50
+
51
+ expect do
52
+ ch.queue_declare(s, durable: true, exclusive: false)
53
+ end.to raise_error(Bunny::PreconditionFailed)
54
+
55
+ # channel.close is sent and handled concurrently with the test
56
+ sleep 1
57
+ expect(ch).to be_closed
58
+
59
+ expect { ch.close }.to raise_error(Bunny::ChannelAlreadyClosed)
60
+ end
24
61
  end
25
62
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bunny
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.4
4
+ version: 2.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Duncan
@@ -12,20 +12,20 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2018-01-09 00:00:00.000000000 Z
15
+ date: 2017-12-18 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: amq-protocol
19
19
  requirement: !ruby/object:Gem::Requirement
20
20
  requirements:
21
- - - "~>"
21
+ - - ">="
22
22
  - !ruby/object:Gem::Version
23
23
  version: 2.2.0
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  requirements:
28
- - - "~>"
28
+ - - ">="
29
29
  - !ruby/object:Gem::Version
30
30
  version: 2.2.0
31
31
  description: Easy to use, feature complete Ruby client for RabbitMQ 3.3 and later
@@ -232,7 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
232
232
  version: '0'
233
233
  requirements: []
234
234
  rubyforge_project:
235
- rubygems_version: 2.6.13
235
+ rubygems_version: 2.6.11
236
236
  signing_key:
237
237
  specification_version: 4
238
238
  summary: Popular easy to use Ruby client for RabbitMQ