Skip to content

Change Queue default to durable=True - #164

Merged
gmr merged 1 commit into
mainfrom
feature/durable-queue-default
Oct 20, 2026
Merged

gmr merged 1 commit into
mainfrom
feature/durable-queue-default

Conversation

@gmr

@gmr gmr commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

rabbitpy.Queue now defaults to durable=True, so Queue(channel, name).declare() works on RabbitMQ 4.3.

Problem

RabbitMQ 4.3 rejects transient non-exclusive queues and closes the connection with INTERNAL_ERROR - Feature transient_nonexcl_queues is deprecated. With the old default of durable=False, the simplest use of Queue fails on current brokers. CodeRabbit raised this on #163.

Solution

  • Set the durable default to True in Queue.__init__ and on the class.
  • Update the four unit tests that assert the default.
  • Add a breaking-change entry to docs/history.md under "Unreleased".

rabbitpy.simple.create_queue already defaults to durable=True, so the two APIs now agree.

Breaking change: if a queue with the same name already exists as non-durable, the declare now fails with AMQPPreconditionFailed. The reverse is also true. To keep the old behaviour, pass durable=False. On RabbitMQ 4.3, also pass exclusive=True. Release this as a major version (4.0.0).

Tests: 369 pass locally against RabbitMQ 4.3.6.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Changes

    • Queues are now durable by default, improving compatibility with RabbitMQ 4.3.
    • Transient queues remain supported when explicitly configured as non-durable and exclusive.
  • Documentation

    • Added an unreleased changelog entry describing the updated queue default.

RabbitMQ 4.3 rejects transient non-exclusive queues with
INTERNAL_ERROR (Feature `transient_nonexcl_queues` is deprecated).
With the old default of durable=False, Queue(channel, name).declare()
fails on RabbitMQ 4.3.

- Set the durable default to True in Queue.__init__ and on the class.
- Update the unit tests that assert the default.
- Add a breaking-change entry to the version history.

This is a breaking change. If a durable queue with the same name
already exists, a declare with durable=False now fails, and the
reverse is also true.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Team
  • Run ID: fa12831a-2dbe-4827-afc6-e4b5028741d2
📥 Commits

Reviewing files that changed from the base of the PR and between a5dab43 and 8ec2bdc.

📒 Files selected for processing: 3
  • docs/history.md
  • rabbitpy/amqp_queue.py
  • tests/test_queue.py

Included review availability: This review used your included allowance. 9 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 10 reviews per hour.

📝 Walkthrough

Queue now defaults to durable queues. Tests and the Unreleased changelog entry reflect the new default. Callers can still set durable explicitly.

Changes: Queue Durability

Layer / File(s) Summary
Queue default and validation
rabbitpy/amqp_queue.py, tests/test_queue.py, docs/history.md
The class and constructor default to durable=True. Tests check default initialization and declarations. The changelog documents the default and notes that transient queues require durable=False, exclusive=True under RabbitMQ 4.3.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 8ec2b

This change is documented and preserves an explicit opt-out for callers needing transient queues.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 2 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: Queue now defaults to durable=True.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 2 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks the queue’s new default with care,
Durable by default, it hops through the air.
For transient queues, the right flags now align,
Explicit choices still work just fine.
The tests and changelog record the way,
Then the rabbit bounds off to play.

Comment @coderabbitai help to get the list of available commands.

@gmr

gmr commented Oct 20, 2026

Copy link
Copy Markdown
Owner Author

PR monitor summary: all CI checks pass (test 3.11, 3.12, 3.13, 3.14 and CodeRabbit). CodeRabbit reviewed HEAD 8ec2bdc and found 0 actionable comments. There are 0 unresolved review threads. No code changes were necessary. The PR is not merged.

@gmr
gmr merged commit a343a7e into main Oct 20, 2026
5 checks passed
@gmr
gmr deleted the feature/durable-queue-default branch October 20, 2026 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant