bunny 3.4.0 → 3.5.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
  SHA256:
3
- metadata.gz: ca20b85fa97e5dfdf990bf45cbf000331d413a9aff294c121a788d7883a053bd
4
- data.tar.gz: 69f78dded2ac65e651ba70baab933119b9cd80663a1bc0d5dae52767d01dae5c
3
+ metadata.gz: 0c409adf026a09b52061cdbca1d1ea72e6312f11085712f3ba586111fc62fd91
4
+ data.tar.gz: c90db5d9e534fb527899221f0a13fb91e13ef18cc178f064f077a7984da692d5
5
5
  SHA512:
6
- metadata.gz: 2b6bb72790ce461357e9934be10ae6a1b1d07744d835bed51c1add5502bbf4710ff9cc16e87e4b685b0fe31a9a8bd932dc00c6d9795cfc3f03ca6b03df6b0e40
7
- data.tar.gz: 53978c476c2e712a4e624765fcd66ce5d4dd8cc99eeb364a244f26990d303ea3600d394db130db949040f0a76c59fc76657f6c2a714bb26bc45f84229c1cc5bb
6
+ metadata.gz: 9fadf7743831aef18668dc5394c3a888b89f39f2afeb71c73f99a0553722ed365ed26fa571cd1a0d0ed27240c5b35b2c0fa4b330b9b2acfe25339bebf5e49fca
7
+ data.tar.gz: 465c8430c93d6895c510f4fc8d66493f0c2a17493ce1685175305f8ed6a704017e85098972c074c8bca67fb12611c01e9820d33da21120b3cbdfa37a226a17d9
data/ChangeLog.md CHANGED
@@ -1,11 +1,41 @@
1
+ ## Changes between Bunny 3.5.0 and 3.6.0
2
+
3
+ No changes yet.
4
+
5
+
6
+ ## Changes between Bunny 3.4.0 and 3.5.0 (Oct 25, 2026)
7
+
8
+ ### `no_declare: true` Is Respected by Topology Recovery
9
+
10
+ Queues and exchanges instantiated with `no_declare: true` are no longer redeclared during recovery.
11
+
12
+ GitHub issue: [#751](https://github.com/ruby-amqp/bunny/issues/751)
13
+
14
+ ### `basic.cancel-ok` for Server-Initiated Consumer Cancellations
15
+
16
+ For RabbitMQ versions that declare a corresponding capability, Bunny now responds to a
17
+ server-sent `basic.cancel` with a `basic.cancel-ok`.
18
+
19
+ See [rabbitmq/rabbitmq-server#17734](https://github.com/rabbitmq/rabbitmq-server/issues/17734) and [rabbitmq/rabbitmq-java-client#2113](https://github.com/rabbitmq/rabbitmq-java-client/issues/2113) for context.
20
+
21
+ ### `Bunny::Session#server_has_capability?`
22
+
23
+ New `Bunny::Session#server_has_capability?` takes a capability name as a symbol.
24
+
25
+ ### `Bunny::DeliveryInfo#to_s` and `#inspect` Use Channel and Consumer Identifiers
26
+
27
+ `Bunny::DeliveryInfo#to_s` and `#inspect` now include the channel number and consumer tag
28
+ but avoid printing the actual data structures.
29
+
30
+ See [ruby-amqp/kicks#48](https://github.com/ruby-amqp/kicks/pull/48) for background.
31
+
32
+
1
33
  ## Changes between Bunny 3.3.0 and 3.4.0 (Sep 18, 2026)
2
34
 
3
35
  ### Ruby 3.2 or Later Is Now Required
4
36
 
5
37
  `required_ruby_version` was raised from `3.0` to `3.2`.
6
38
 
7
- Ruby `3.0` and `3.1` have reached end of life and are no longer tested against.
8
-
9
39
 
10
40
  ### Client Certificate Chains
11
41
 
data/lib/bunny/channel.rb CHANGED
@@ -523,7 +523,6 @@ module Bunny
523
523
 
524
524
  q = find_queue(name) || Bunny::Queue.new(self, name, opts)
525
525
 
526
- record_queue(q) unless opts[:passive]
527
526
  register_queue(q)
528
527
  end
529
528
 
@@ -652,7 +651,6 @@ module Bunny
652
651
  )
653
652
  q = find_queue(name) || Bunny::Queue.new(self, name, final_opts)
654
653
 
655
- record_queue(q)
656
654
  register_queue(q)
657
655
  end
658
656
 
@@ -2130,6 +2128,13 @@ module Bunny
2130
2128
  pending_server_named_queue_declaration?
2131
2129
  end
2132
2130
 
2131
+ # @private
2132
+ def send_basic_cancel_ok(consumer_tag)
2133
+ tag = consumer_tag.to_s
2134
+ payload = [AMQ::Protocol::Basic::CancelOk.index, tag.bytesize, tag].pack("NCa*")
2135
+ @connection.send_frame(AMQ::Protocol::MethodFrame.new(payload, @id))
2136
+ end
2137
+
2133
2138
  # @private
2134
2139
  def handle_method(method)
2135
2140
  @logger.debug { "Channel#handle_frame on channel #{@id}: #{method.inspect}" }
@@ -2171,6 +2176,8 @@ module Bunny
2171
2176
  when AMQ::Protocol::Basic::ConsumeOk then
2172
2177
  @continuations.push(method)
2173
2178
  when AMQ::Protocol::Basic::Cancel then
2179
+ send_basic_cancel_ok(method.consumer_tag) if @connection.server_has_capability?(:accept_consumer_cancel_ok)
2180
+
2174
2181
  if consumer = @consumers[method.consumer_tag]
2175
2182
  @work_pool.submit do
2176
2183
  begin
@@ -64,12 +64,12 @@ module Bunny
64
64
 
65
65
  # @private
66
66
  def to_s
67
- to_hash.to_s
67
+ printable_hash.to_s
68
68
  end
69
69
 
70
70
  # @private
71
71
  def inspect
72
- to_hash.inspect
72
+ printable_hash.inspect
73
73
  end
74
74
 
75
75
  # @return [String] Consumer tag this delivery is for
@@ -97,5 +97,11 @@ module Bunny
97
97
  def routing_key
98
98
  @basic_deliver.routing_key
99
99
  end
100
+
101
+ private
102
+
103
+ def printable_hash
104
+ to_hash.merge(consumer: @consumer&.consumer_tag, channel: @channel&.number)
105
+ end
100
106
  end
101
107
  end
@@ -108,9 +108,6 @@ module Bunny
108
108
 
109
109
  # for basic.return dispatch and such
110
110
  @channel.register_exchange(self)
111
- # for topology recovery. A passive declaration does not own the exchange,
112
- # so it must not overwrite what was recorded for it earlier
113
- @channel.record_exchange(self) unless @options[:passive]
114
111
  end
115
112
 
116
113
  # @return [Boolean] true if this exchange was declared as durable (will survive broker restart).
data/lib/bunny/queue.rb CHANGED
@@ -91,9 +91,6 @@ module Bunny
91
91
 
92
92
  # for basic.deliver dispatch and such
93
93
  @channel.register_queue(self)
94
- # for topology recovery. A passive declaration does not own the queue,
95
- # so it must not overwrite what was recorded for it earlier
96
- @channel.record_queue(self) unless @options[:passive]
97
94
  end
98
95
 
99
96
  # @return [Boolean] true if this queue was declared as durable (will survive broker restart).
data/lib/bunny/session.rb CHANGED
@@ -1593,6 +1593,12 @@ module Bunny
1593
1593
  to_s
1594
1594
  end
1595
1595
 
1596
+ # @param [Symbol] capability a server capability name
1597
+ # @return [Boolean] true if the server advertises the capability as supported
1598
+ def server_has_capability?(capability)
1599
+ (@server_capabilities || {})[capability.to_s] == true
1600
+ end
1601
+
1596
1602
  protected
1597
1603
 
1598
1604
  # @private
data/lib/bunny/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Bunny
4
4
  # @return [String] Version of the library
5
- VERSION = "3.4.0"
5
+ VERSION = "3.5.0"
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: 3.4.0
4
+ version: 3.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Duncan
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  - !ruby/object:Gem::Version
151
151
  version: '0'
152
152
  requirements: []
153
- rubygems_version: 4.0.16
153
+ rubygems_version: 3.6.9
154
154
  specification_version: 4
155
155
  summary: Popular easy to use Ruby client for RabbitMQ
156
156
  test_files: []