async-rabbitmq 0.6.0 → 0.7.1

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: 77df2cb6ea955db0392941563a8e6c43cc55ad06d429c1f8d45ea05bd79ecb50
4
- data.tar.gz: 1ea2fbdc554c5901638002e7d4c16cbaf5c9af7189434b06fb1003eef2894d14
3
+ metadata.gz: 12f881a8b2274539cd1e93e8ea827140887f0a392952dcd123270acaf5d4aea3
4
+ data.tar.gz: 94ad7522a6b7c33d5cde8b892c0629b5db4961b9eb289c4efc6ab6c3f7286c66
5
5
  SHA512:
6
- metadata.gz: '0197dc20bc43a0863883f0a723a4120844c05bbc1542a42509fa7cb98473414f860d034a65cdf8e645a8a7aec414c6bfa347887b803d191c14745ec4dc4b2681'
7
- data.tar.gz: aaa2b3835cfefed5612f5b0e93f68dd3f9985d0cd4436c1201e5d7907b2fe25c194a05249de67680b7531ce3c8aaa22bc8d95a8fa15317539755da9c6eb8f0ba
6
+ metadata.gz: ed9504ed356545629ff40c48ee8e3d7dadd6482538fff0bd3539c2c48dcb020c3b5949538dd1382a4b9b4f5bd650986eda6782efe7b9ce10545e047474788cae
7
+ data.tar.gz: cca32432f4ca23fc9b32150ce48684d9fde94feb8a0f9b9927e7186d4de59e6ee32677d3a437549559013e9c94a8350e5ea40eeb1c4f748ef9418470af2c593e
data/CHANGELOG.md CHANGED
@@ -2,6 +2,30 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [0.7.1] - 2026-10-18
6
+
7
+ ### Added
8
+
9
+ - `AsyncRabbitMQ::DEFAULT_CONTENT_TYPE` and `AsyncRabbitMQ::Channel::DEFAULT_CONTENT_TYPE` constants (`"application/octet-stream"`).
10
+
11
+ ### Changed
12
+
13
+ - Default publish properties aligned with Bunny parity: `content_type` defaults to `"application/octet-stream"`, `persistent` defaults to `true` (`delivery_mode: 2`), and `priority` defaults to `0`.
14
+
15
+ ## [0.7.0] - 2026-10-17
16
+
17
+ ### Fixed
18
+
19
+ - A consumer's `on_error:` survives re-registration after a reconnect or a channel reopen; it no
20
+ longer falls back to the channel default.
21
+ - A consumer's `exclusive:` flag and `arguments:` (such as `x-priority`) survive re-registration
22
+ after a reconnect or a channel reopen; they no longer come back as the defaults.
23
+
24
+ ### Added
25
+
26
+ - `Channel#each` passes its remaining keywords to `basic_consume`, so `on_error:`, `exclusive:`
27
+ and `arguments:` work there as they do on the other two ways to start a consumer.
28
+
5
29
  ## [0.6.0] - 2026-10-11
6
30
 
7
31
  ### Fixed
@@ -37,6 +37,8 @@ module AsyncRabbitMQ
37
37
  # delivery the verbs are otherwise equivalent.
38
38
  ERROR_DISPOSITIONS = %i[dead_letter retry release leave].freeze
39
39
 
40
+ DEFAULT_CONTENT_TYPE = "application/octet-stream".freeze
41
+
40
42
  # A handler is application code and can raise anything. Catching only
41
43
  # StandardError let a handler raising outside that hierarchy escape and take
42
44
  # the channel's frame dispatch with it, so the catch below is deliberately
@@ -483,8 +485,11 @@ module AsyncRabbitMQ
483
485
  AMQ::Protocol::Basic::Consume.encode(@channel_id, queue_name, consumer_tag, false, !manual_ack, exclusive, false, arguments),
484
486
  AMQ::Protocol::Basic::ConsumeOk
485
487
  )
488
+ # Everything basic.consume was called with, so re_register_consumers can
489
+ # reproduce the consumer exactly rather than a default-valued lookalike.
486
490
  @consumers[resp.consumer_tag] = { queue_name: queue_name, block: block,
487
- manual_ack: manual_ack, on_error: on_error }
491
+ manual_ack: manual_ack, on_error: on_error,
492
+ exclusive: exclusive, arguments: arguments }
488
493
  topology&.record_consumer(resp.consumer_tag, queue_name)
489
494
  instrument("consumer.registered") do
490
495
  { channel: @channel_id, queue: queue_name, consumer_tag: resp.consumer_tag, manual_ack: manual_ack }
@@ -692,9 +697,11 @@ module AsyncRabbitMQ
692
697
  # the broker cancels the consumer (e.g. the queue is deleted) or closes the
693
698
  # channel. A connection loss with automatic recovery is transparent: the
694
699
  # consumer is re-registered and #each keeps waiting.
695
- def each(queue_name, manual_ack: false, &block)
700
+ # Remaining keywords go to #basic_consume, so +on_error+, +exclusive+ and
701
+ # +arguments+ work here as they do there.
702
+ def each(queue_name, manual_ack: false, **opts, &block)
696
703
  assert_open!
697
- tag = basic_consume(queue_name, manual_ack: manual_ack, &block)
704
+ tag = basic_consume(queue_name, manual_ack: manual_ack, **opts, &block)
698
705
  cond = @each_waiters[tag] = Async::Condition.new
699
706
  cond.wait
700
707
  nil
@@ -1488,16 +1495,18 @@ module AsyncRabbitMQ
1488
1495
 
1489
1496
  # Encode one basic.publish (method + header + body frames) into a single
1490
1497
  # byte string, so a message always hits the write queue in one piece.
1491
- def encode_publish(payload, exchange:, routing_key:, mandatory: false, persistent: false,
1492
- content_type: nil, content_encoding: nil, headers: nil, priority: nil,
1498
+ def encode_publish(payload, exchange:, routing_key:, mandatory: false, persistent: true,
1499
+ content_type: DEFAULT_CONTENT_TYPE, content_encoding: nil, headers: nil, priority: 0,
1493
1500
  correlation_id: nil, reply_to: nil, expiration: nil, message_id: nil,
1494
1501
  timestamp: nil, type: nil, user_id: nil, app_id: nil, properties: {})
1495
1502
  payload_bytes = payload.is_a?(String) ? payload.b : payload
1496
- props = { delivery_mode: persistent ? 2 : 1 }
1497
- props[:content_type] = content_type if content_type
1503
+ props = {
1504
+ delivery_mode: persistent ? 2 : 1,
1505
+ content_type: content_type || DEFAULT_CONTENT_TYPE,
1506
+ priority: priority || 0
1507
+ }
1498
1508
  props[:content_encoding] = content_encoding if content_encoding
1499
1509
  props[:headers] = headers if headers
1500
- props[:priority] = priority if priority
1501
1510
  props[:correlation_id] = correlation_id if correlation_id
1502
1511
  props[:reply_to] = reply_to if reply_to
1503
1512
  props[:expiration] = expiration if expiration
@@ -1638,7 +1647,9 @@ module AsyncRabbitMQ
1638
1647
  def re_register_consumers
1639
1648
  @consumers.each do |tag, entry|
1640
1649
  begin
1641
- basic_consume(entry[:queue_name], consumer_tag: tag, manual_ack: entry[:manual_ack], &entry[:block])
1650
+ basic_consume(entry[:queue_name], consumer_tag: tag, manual_ack: entry[:manual_ack],
1651
+ exclusive: entry[:exclusive], arguments: entry[:arguments] || {},
1652
+ on_error: entry[:on_error], &entry[:block])
1642
1653
  rescue => e
1643
1654
  # Typically 404: the queue is gone and was not recovered. The broker
1644
1655
  # closes the channel on that, so say so instead of failing silently.
@@ -1,3 +1,3 @@
1
1
  module AsyncRabbitMQ
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.1"
3
3
  end
@@ -32,5 +32,7 @@ require_relative "async_rabbitmq/session"
32
32
  require_relative "async_rabbitmq/cluster"
33
33
 
34
34
  module AsyncRabbitMQ
35
+ DEFAULT_CONTENT_TYPE = Channel::DEFAULT_CONTENT_TYPE
36
+
35
37
  # Optional: require "async_rabbitmq/pool" for connection pooling.
36
38
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-rabbitmq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Russell Penney
@@ -174,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
174
  - !ruby/object:Gem::Version
175
175
  version: '0'
176
176
  requirements: []
177
- rubygems_version: 3.6.7
177
+ rubygems_version: 4.0.20
178
178
  specification_version: 4
179
179
  summary: Fiber-native Ruby AMQP 0-9-1 client built on the Async ecosystem
180
180
  test_files: []