bunny 2.15.0 → 2.16.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6abcaa979facd973a801a4433d3a6985e15e89aa84cc0078cc464af3be6c4542
4
- data.tar.gz: d8bc430b598d1a267fe075028e9536efeeb008c72d9387daaaa30c79391d54d8
3
+ metadata.gz: 94a05191f06bd28c3c4714a67c70a5097341f7d07961cb97df83ad5414a0e541
4
+ data.tar.gz: 3521b4979e62eb7a5d6c1f54cb5a17cbda33706f696288ec2c8a0ee0397c3ddf
5
5
  SHA512:
6
- metadata.gz: 384472c28da9fabdf01a9e1c403c9009bf000cd8a3256cbffab531f7e5582425d15320255a966b89c5075f1fb1bc029deef21e1d5fd776de2d4f9714e8f1553f
7
- data.tar.gz: 2ccbfbde0c9f0a2ff0202cb1160d569cbbdc94095e79d021d59a9e7949fd1579189fddcb61849125d4cfefce7ad0a733943f7d3a54097e7fb2ed83117f15ec1f
6
+ metadata.gz: 54314055b9f79e3c334d461f0a63f17fa50e7fe0b39fa71a9314b194db02a8416a057e66123f8b2d7d13353b69f018799a785dd59ea54eeea3d882ec8511b650
7
+ data.tar.gz: 9721730e57e5da633568b859f8df0feada37d4303b94f68e78d6a291d0d9d2e6409fa5a7fdcbb59ea5cb5a557c04e750ec7a1098496ab439bd2077b260ea4c3c
@@ -1,3 +1,21 @@
1
+ ## Changes between Bunny 2.16.0 and 2.17.0 (undefined)
2
+
3
+ No changes yet.
4
+
5
+
6
+ ## Changes between Bunny 2.15.0 and 2.16.0 (Aug 14th, 2020)
7
+
8
+ ### Asynchronous Exception Delegate
9
+
10
+ Bunny now can delete asynchronous connection (`Bunny::Session`) exception to an arbitrary
11
+ delegate object. Use the `:session_error_handler` connection setting to pass it.
12
+ The value defaults to `Thread.current`.
13
+
14
+ Contributed by @bbascarevic.
15
+
16
+ GitHub issue: [ruby-amqp/bunny#597](https://github.com/ruby-amqp/bunny/issues/597)
17
+
18
+
1
19
  ## Changes between Bunny 2.14.0 and 2.15.0 (Apr 8th, 2020)
2
20
 
3
21
  ### More Defensive Thread Join Operations
@@ -1156,7 +1156,7 @@ module Bunny
1156
1156
 
1157
1157
  # @group Exchange operations (exchange.*)
1158
1158
 
1159
- # Declares a exchange using echange.declare AMQP 0.9.1 method.
1159
+ # Declares a exchange using exchange.declare AMQP 0.9.1 method.
1160
1160
  #
1161
1161
  # @param [String] name The name of the exchange. Note that LF and CR characters
1162
1162
  # will be stripped from the value.
@@ -9,17 +9,17 @@ module Bunny
9
9
  # @private
10
10
  class ReaderLoop
11
11
 
12
- def initialize(transport, session, session_thread)
13
- @transport = transport
14
- @session = session
15
- @session_thread = session_thread
16
- @logger = @session.logger
12
+ def initialize(transport, session, session_error_handler)
13
+ @transport = transport
14
+ @session = session
15
+ @session_error_handler = session_error_handler
16
+ @logger = @session.logger
17
17
 
18
- @mutex = Mutex.new
18
+ @mutex = Mutex.new
19
19
 
20
- @stopping = false
21
- @stopped = false
22
- @network_is_down = false
20
+ @stopping = false
21
+ @stopped = false
22
+ @network_is_down = false
23
23
  end
24
24
 
25
25
 
@@ -47,7 +47,7 @@ module Bunny
47
47
  @session.handle_network_failure(e)
48
48
  else
49
49
  log_exception(e)
50
- @session_thread.raise(Bunny::NetworkFailure.new("detected a network failure: #{e.message}", e))
50
+ @session_error_handler.raise(Bunny::NetworkFailure.new("detected a network failure: #{e.message}", e))
51
51
  end
52
52
  rescue ShutdownSignal => _
53
53
  @mutex.synchronize { @stopping = true }
@@ -58,7 +58,7 @@ module Bunny
58
58
  log_exception(e)
59
59
 
60
60
  @network_is_down = true
61
- @session_thread.raise(Bunny::NetworkFailure.new("caught an unexpected exception in the network loop: #{e.message}", e))
61
+ @session_error_handler.raise(Bunny::NetworkFailure.new("caught an unexpected exception in the network loop: #{e.message}", e))
62
62
  end
63
63
  rescue Errno::EBADF => _ebadf
64
64
  break if terminate?
@@ -124,6 +124,7 @@ module Bunny
124
124
  # @option connection_string_or_opts [Integer] :recovery_attempts (nil) Max number of recovery attempts, nil means forever
125
125
  # @option connection_string_or_opts [Integer] :reset_recovery_attempts_after_reconnection (true) Should recovery attempt counter be reset after successful reconnection? When set to false, the attempt counter will last through the entire lifetime of the connection object.
126
126
  # @option connection_string_or_opts [Boolean] :recover_from_connection_close (true) Should this connection recover after receiving a server-sent connection.close (e.g. connection was force closed)?
127
+ # @option connection_string_or_opts [Object] :session_error_handler (Thread.current) Object which responds to #raise that will act as a session error handler. Defaults to Thread.current, which will raise asynchronous exceptions in the thread that created the session.
127
128
  #
128
129
  # @option optz [String] :auth_mechanism ("PLAIN") Authentication mechanism, PLAIN or EXTERNAL
129
130
  # @option optz [String] :locale ("PLAIN") Locale RabbitMQ should use
@@ -213,9 +214,9 @@ module Bunny
213
214
  @address_index_mutex = @mutex_impl.new
214
215
 
215
216
  @channels = Hash.new
216
- @recovery_completed = opts[:recovery_completed]
217
+ @recovery_completed = opts[:recovery_completed]
217
218
 
218
- @origin_thread = Thread.current
219
+ @session_error_handler = opts.fetch(:session_error_handler, Thread.current)
219
220
 
220
221
  self.reset_continuations
221
222
  self.initialize_transport
@@ -862,7 +863,7 @@ module Bunny
862
863
 
863
864
  clean_up_on_shutdown
864
865
  if threaded?
865
- @origin_thread.raise(@last_connection_error)
866
+ @session_error_handler.raise(@last_connection_error)
866
867
  else
867
868
  raise @last_connection_error
868
869
  end
@@ -1019,7 +1020,7 @@ module Bunny
1019
1020
 
1020
1021
  # @private
1021
1022
  def reader_loop
1022
- @reader_loop ||= ReaderLoop.new(@transport, self, Thread.current)
1023
+ @reader_loop ||= ReaderLoop.new(@transport, self, @session_error_handler)
1023
1024
  end
1024
1025
 
1025
1026
  # @private
@@ -1282,7 +1283,7 @@ module Bunny
1282
1283
  end
1283
1284
 
1284
1285
  if threaded?
1285
- @origin_thread.raise(e)
1286
+ @session_error_handler.raise(e)
1286
1287
  else
1287
1288
  raise e
1288
1289
  end
@@ -1328,7 +1329,7 @@ module Bunny
1328
1329
  @transport = Transport.new(self,
1329
1330
  host_from_address(address),
1330
1331
  port_from_address(address),
1331
- @opts.merge(:session_thread => @origin_thread)
1332
+ @opts.merge(:session_error_handler => @session_error_handler)
1332
1333
  )
1333
1334
 
1334
1335
  # Reset the cached progname for the logger only when no logger was provided
@@ -35,7 +35,7 @@ module Bunny
35
35
 
36
36
  def initialize(session, host, port, opts)
37
37
  @session = session
38
- @session_thread = opts[:session_thread]
38
+ @session_error_handler = opts[:session_error_handler]
39
39
  @host = host
40
40
  @port = port
41
41
  @opts = opts
@@ -146,7 +146,7 @@ module Bunny
146
146
  if @session.automatically_recover?
147
147
  @session.handle_network_failure(e)
148
148
  else
149
- @session_thread.raise(Bunny::NetworkFailure.new("detected a network failure: #{e.message}", e))
149
+ @session_error_handler.raise(Bunny::NetworkFailure.new("detected a network failure: #{e.message}", e))
150
150
  end
151
151
  end
152
152
  end
@@ -170,7 +170,7 @@ module Bunny
170
170
  if @session.automatically_recover?
171
171
  @session.handle_network_failure(e)
172
172
  else
173
- @session_thread.raise(Bunny::NetworkFailure.new("detected a network failure: #{e.message}", e))
173
+ @session_error_handler.raise(Bunny::NetworkFailure.new("detected a network failure: #{e.message}", e))
174
174
  end
175
175
  end
176
176
  end
@@ -188,7 +188,7 @@ module Bunny
188
188
  if @session.automatically_recover?
189
189
  @session.handle_network_failure(e)
190
190
  else
191
- @session_thread.raise(Bunny::NetworkFailure.new("detected a network failure: #{e.message}", e))
191
+ @session_error_handler.raise(Bunny::NetworkFailure.new("detected a network failure: #{e.message}", e))
192
192
  end
193
193
  end
194
194
  end
@@ -245,7 +245,7 @@ module Bunny
245
245
  if @session.automatically_recover?
246
246
  raise
247
247
  else
248
- @session_thread.raise(Bunny::NetworkFailure.new("detected a network failure: #{e.message}", e))
248
+ @session_error_handler.raise(Bunny::NetworkFailure.new("detected a network failure: #{e.message}", e))
249
249
  end
250
250
  end
251
251
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Bunny
4
4
  # @return [String] Version of the library
5
- VERSION = "2.15.0"
5
+ VERSION = "2.16.1"
6
6
  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.15.0
4
+ version: 2.16.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Duncan
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2020-04-08 00:00:00.000000000 Z
15
+ date: 2020-08-14 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: amq-protocol