Skip to content

Commit dea05d4

Browse files
2.6.0
1 parent e4bb92f commit dea05d4

5 files changed

Lines changed: 112 additions & 1 deletion

File tree

AGENTS.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,30 @@ This library targets Ruby 3.0 and later versions.
1414

1515
* Only add very important comments, both in tests and in the implementation
1616

17+
## Change Log
18+
19+
If asked to perform change log updates, consult and modify `ChangeLog.md` and stick to its
20+
existing writing style.
21+
22+
23+
## Releases
24+
25+
### How to Roll (Produce) a New Release
26+
27+
Suppose the current development version in `ChangeLog.md` has
28+
a `## Changes between X.Y.0 and X.(Y+1).0 (unreleased)` section at the top.
29+
30+
To produce a new release:
31+
32+
1. Update `ChangeLog.md`: replace `(unreleased)` with today's date, e.g. `(Mar 30, 2026)`. Make sure all notable changes since the previous release are listed
33+
2. Update the version in `lib/amq/protocol/version.rb` to match
34+
3. Commit with the message `X.(Y+1).0` (just the version number, nothing else)
35+
4. Tag the commit: `git tag vX.(Y+1).0`
36+
5. Bump the dev version: add a new `## Changes between X.(Y+1).0 and X.(Y+2).0 (unreleased)` section to `ChangeLog.md` with `No changes yet.` underneath, and update `lib/amq/protocol/version.rb` to the next dev version
37+
6. Commit with the message `Bump dev version`
38+
7. Push: `git push && git push --tags`
39+
40+
1741
## Git Instructions
1842

1943
* Never add yourself to the list of commit co-authors

ChangeLog.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
1-
## Changes between 2.5.1 and 2.6.0 (in development)
1+
## Changes between 2.6.0 and 2.7.0 (unreleased)
22

33
No changes yet.
44

55

6+
## Changes between 2.5.1 and 2.6.0 (Mar 30, 2026)
7+
8+
### Channel.Close Predicate Methods
9+
10+
`Channel::Close` now provides predicate methods for identifying common
11+
channel closure reasons by reply code and text:
12+
13+
* `#delivery_ack_timeout?`: consumer [delivery acknowledgement timeout](https://www.rabbitmq.com/docs/consumers#acknowledgement-timeout)
14+
* `#unknown_delivery_tag?`: unknown delivery tag (e.g. [double ack](https://www.rabbitmq.com/docs/channels#error-handling))
15+
* `#message_too_large?`: message exceeded the configured max size
16+
17+
618
## Changes between 2.5.0 and 2.5.1 (Jan 19, 2026)
719

820
### Windows Installation Fixes

lib/amq/protocol.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22

33
require "amq/protocol/version"
44
require "amq/protocol/client"
5+
require "amq/protocol/channel_close"

lib/amq/protocol/channel_close.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# frozen_string_literal: true
2+
3+
module AMQ
4+
module Protocol
5+
class Channel
6+
class Close
7+
# @return [Boolean] true if the channel was closed due to a consumer delivery acknowledgement timeout
8+
def delivery_ack_timeout?
9+
reply_code == 406 && reply_text =~ /delivery acknowledgement on channel \d+ timed out/
10+
end
11+
12+
# @return [Boolean] true if the channel was closed due to an unknown delivery tag (e.g. double ack)
13+
def unknown_delivery_tag?
14+
reply_code == 406 && reply_text =~ /unknown delivery tag/
15+
end
16+
17+
# @return [Boolean] true if the channel was closed because a message exceeded the configured max size
18+
def message_too_large?
19+
reply_code == 406 && reply_text =~ /larger than configured max size/
20+
end
21+
end
22+
end
23+
end
24+
end
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# encoding: binary
2+
3+
module AMQ
4+
module Protocol
5+
class Channel
6+
RSpec.describe Close do
7+
describe "#delivery_ack_timeout?" do
8+
it "returns true for delivery acknowledgement timeout" do
9+
close = Close.new(406, "PRECONDITION_FAILED - delivery acknowledgement on channel 1 timed out. Timeout value used: 1800000 ms", 0, 0)
10+
expect(close.delivery_ack_timeout?).to be_truthy
11+
end
12+
13+
it "returns false for an unknown delivery tag" do
14+
close = Close.new(406, "PRECONDITION_FAILED - unknown delivery tag 82", 0, 0)
15+
expect(close.delivery_ack_timeout?).to be_falsey
16+
end
17+
18+
it "returns false for a different reply code" do
19+
close = Close.new(404, "NOT_FOUND - no queue", 0, 0)
20+
expect(close.delivery_ack_timeout?).to be_falsey
21+
end
22+
end
23+
24+
describe "#unknown_delivery_tag?" do
25+
it "returns true for an unknown delivery tag" do
26+
close = Close.new(406, "PRECONDITION_FAILED - unknown delivery tag 82", 0, 0)
27+
expect(close.unknown_delivery_tag?).to be_truthy
28+
end
29+
30+
it "returns false for a delivery ack timeout" do
31+
close = Close.new(406, "PRECONDITION_FAILED - delivery acknowledgement on channel 1 timed out. Timeout value used: 1800000 ms", 0, 0)
32+
expect(close.unknown_delivery_tag?).to be_falsey
33+
end
34+
end
35+
36+
describe "#message_too_large?" do
37+
it "returns true when message exceeds configured max size" do
38+
close = Close.new(406, "PRECONDITION_FAILED - message size 2000000 is larger than configured max size 1000000", 0, 0)
39+
expect(close.message_too_large?).to be_truthy
40+
end
41+
42+
it "returns false for an unknown delivery tag" do
43+
close = Close.new(406, "PRECONDITION_FAILED - unknown delivery tag 82", 0, 0)
44+
expect(close.message_too_large?).to be_falsey
45+
end
46+
end
47+
end
48+
end
49+
end
50+
end

0 commit comments

Comments
 (0)