Skip to content

fix(amqp): preserve delivery channels during connection recovery - #1894

Open
harshitsharmaaaa wants to merge 1 commit into
conductor-oss:mainfrom
harshitsharmaaaa:fix/1849-amqp-channel-recovery
Open

harshitsharmaaaa wants to merge 1 commit into
conductor-oss:mainfrom
harshitsharmaaaa:fix/1849-amqp-channel-recovery

Conversation

@harshitsharmaaaa

Copy link
Copy Markdown
Contributor

Pull Request type

  • Bugfix
  • Feature
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • WHOSUSING.md
  • Other (please describe):

NOTE: Please remember to run ./gradlew spotlessApply to fix any format violations.

Changes in this PR

Summary

Fixes #1849.

Preserves the original delivery channel for each message during AMQP connection recovery, preventing ACK/NACK operations from using a replacement channel with an invalid delivery tag.

Implementation

  • Added a weak identity-keyed registry to associate messages with their original delivery channels without changing the core Message type.
  • Preserved delivery metadata across failed settlement attempts and cleared it after successful settlement.
  • Moved queue-depth sampling to a publisher channel.
  • Improved recoverable connection shutdown and channel-pool cleanup.
  • Added regression coverage for ACK, NACK, and connection-close recovery.

Validation

  • Focused AMQP unit tests: 24 passed.
  • RabbitMQ recovery integration tests: 3 passed against a real broker (ACK, NACK, and close during recovery).
  • Full AMQP test suite: 38 passed, 0 failed, 0 skipped.
  • Production and test compilation: passed.
  • Spotless checks and git diff --check: passed.

Test Scope

Queue-depth sampling is covered directly through queue.size(). The AdminService HTTP endpoint (GET /api/admin/queues?verbose=true) was not exercised by these tests.

Issue #1849

Alternatives considered

Looking up the channel by queue name at settlement time or retrying on an arbitrary replacement channel can apply a delivery tag to the wrong channel. The delivery-bound identity registry and separate publisher channel for depth sampling address the race without changing the core message type or public API.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
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.

AMQP queue-depth sampling during RabbitMQ recovery can send ACK on the wrong channel

1 participant