Skip to content

Reject classic priority limits on quorum queues - #106

Open
niemyjski wants to merge 5 commits into
mainfrom
feature/rabbitmq-quorum-priority
Open

niemyjski wants to merge 5 commits into
mainfrom
feature/rabbitmq-quorum-priority

Conversation

@niemyjski

@niemyjski niemyjski commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

UseMessagePriority() configures a classic queue's maximum priority. Combining it with an explicitly configured quorum queue now fails locally, before connecting. Per-message priorities remain supported in both queue modes.

Breaking change: remove UseMessagePriority() or MaxPriority from quorum configurations. Builder calls reject the combination in either order; direct options reject it when the bus is constructed. Setting MaxPriority = 0 throws immediately. Classic direct limits of 1–255 and the builder's existing 1–32 range remain supported.

Broker upgrade impact: RabbitMQ 4.3 changes quorum ordering. Priorities 5 and 10 previously shared the high-priority group; they now order separately. Lower priorities lose their guaranteed share and can starve under sustained higher-priority traffic. An omitted priority defaults to 4; RabbitMQ.Client 7.2.2 also omits zero on the wire. Classic priority ordering and already-delivered messages are unaffected by these quorum scheduling changes.

Validation: Release build and formatting passed. Nine new, separate routing and priority cases passed without skips on RabbitMQ 3.13.7, 4.2.5, and 4.3.6, at both this PR and the final aggregate. Both updated-head Linux checks passed. The push run passed 145 tests with 122 infrastructure skips; the local matrix supplies broker evidence for the nine new skipped cases.

Verification and implementation details

The version matrix compares fresh brokers. A rolling upgrade with existing queue data was not exercised.

The untouched pre-PR PublishAsync_WithPriority_DeliversHighPriorityFirst was run against both 4.2.5 and 4.3.6. Both reject its quorum queue with 406 PRECONDITION_FAILED because UseMessagePriority() supplies x-max-priority. Its old green CI run skipped all five inherited copies for missing infrastructure. An earlier publish-before-subscribe reproduction removed the invalid option; it was a modified variant, not the untouched test.

The existing method was rewritten earlier in this PR to subscribe first and hold a warm-up delivery while confirmed messages accumulate. It retains its four strict ordering assertions and skips before 4.3. This latest addition does not edit existing methods again: independent tests cover publication before subscription, in-flight delivery, omitted/zero priority, queued priority levels, and quorum fairness. The new cases run on older brokers with their actual expectations, rather than skipping those versions. A shared helper serves three queued-message scenarios using one bus, fluent configuration, and base cleanup. No raw channels or topology declarations are added.

The warm-up gate fills the single prefetch slot so the broker compares queued messages. Without a backlog, a lower-priority message may already be delivered before higher-priority publication. It belongs in the RabbitMQ provider tests: the shared message-bus contract does not promise priority scheduling, and an in-memory publisher that awaits handlers could deadlock on this arrangement. Base cleanup disposes the bus; persistent quorum queues are removed when the owned broker is torn down.

Seven option tests cover both builder orders, direct options, dictionary mutation before construction, classic limits through 255, and immediate rejection of zero. The field setter validates the scalar value; construction validates the cross-option combination. IsQuorumQueue checks an explicit local string argument, not broker/vhost defaults or existing queue metadata. Post-construction mutation checks belong to #105.

Broker references: 4.2 priority groups, 4.3 priority scheduling. The local results cover priority and routing only, not all 4.3 features. #104 adds owned 4.2.5 and 4.3.6 priority runs to CI. Merge before #104, then #105 and #100.

@niemyjski niemyjski changed the title Avoid classic priority arguments when declaring quorum queues Avoid classic priority arguments on quorum queues Sep 24, 2026
@niemyjski
niemyjski added this pull request to stack #107 September 25, 2026 20:21
@niemyjski
niemyjski force-pushed the feature/rabbitmq-quorum-priority branch 2 times, most recently from 1ab2804 to 37db1e7 Compare September 25, 2026 20:31
Base automatically changed from feature/rabbitmq-tls-endpoints to main September 25, 2026 20:34
@niemyjski
niemyjski force-pushed the feature/rabbitmq-quorum-priority branch from 37db1e7 to 6d5694b Compare September 25, 2026 20:34
@niemyjski niemyjski self-assigned this Sep 25, 2026
@niemyjski niemyjski changed the title Avoid classic priority arguments on quorum queues Keep message priority compatible with classic and quorum queues Sep 25, 2026
@niemyjski
niemyjski marked this pull request as ready for review September 25, 2026 21:04
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-26T02:22:35.157570Z 73064e3 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@niemyjski niemyjski changed the title Keep message priority compatible with classic and quorum queues Reject classic-only priority limits on quorum queues Sep 25, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5cd0b5df37

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

{
using var cleanup = new CancellationTokenSource(TimeSpan.FromSeconds(10));
await admin.QueueDeleteAsync(queueName, cancellationToken: cleanup.Token);
await admin.ExchangeDeleteAsync(topic, cancellationToken: cleanup.Token);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Configure the exchange before deleting it

When RabbitMQ infrastructure is available, every CreateBus() still uses the default SharedMessageBusOptions.Topic because the local topic is never passed to the builder, so the named exchange is never declared. ExchangeDeleteAsync(topic) therefore attempts to delete a nonexistent exchange and raises a channel-level not-found exception from the finally block, causing an otherwise successful priority test to fail; add .Topic(topic) to CreateBus() or clean up the exchange actually configured.

Useful? React with 👍 / 👎.

@niemyjski
niemyjski force-pushed the feature/rabbitmq-quorum-priority branch 3 times, most recently from ce9c3fe to aeaf61a Compare September 25, 2026 22:33
@niemyjski
niemyjski force-pushed the feature/rabbitmq-quorum-priority branch from aeaf61a to 73064e3 Compare September 26, 2026 02:20
@niemyjski niemyjski changed the title Reject classic-only priority limits on quorum queues Reject classic priority limits on quorum queues Sep 26, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

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