Support MessageGroupId on standard SQS queues for fair queues (GH-2886)#2889
Merged
Conversation
AWS SQS standard queues now support "fair queues" by setting MessageGroupId on messages, mitigating noisy-neighbor dwell time in multi-tenant workloads. Wolverine already maps Envelope.GroupId -> SQS MessageGroupId, but only for FIFO queues (names ending in .fifo); standard queues never received it. Add an opt-in, per-endpoint EnableFairQueueMessageGroups() that maps Envelope.GroupId -> MessageGroupId on standard queues too, with no ordering or deduplication semantics (MessageDeduplicationId stays FIFO-only). The group id is derived through the envelope-mapping layer via the new ISqsEnvelopeMapper.DetermineGroupId(Envelope) (a default interface method returning Envelope.GroupId, so existing custom mappers are unaffected and can override to source the group id from a header/tenant id). Both send paths (AmazonSqsQueue.SendMessageAsync and OutgoingSqsBatch) now consult the mapper and gate on FIFO vs the opt-in flag. FIFO behavior is unchanged. Adds unit tests and a Fair Queues docs page. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 28, 2026
Closed
This was referenced Jun 2, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Closes #2886.
AWS SQS standard queues now support fair queues: setting
MessageGroupIdon a standard queue improves fairness for multi-tenant workloads so one tenant's backlog doesn't increase dwell time for others.Wolverine already maps
Envelope.GroupId→ SQSMessageGroupId, but the mapping was gated behindIsFifoQueue(queue names ending in.fifo), so standard queues never received aMessageGroupIdeven when the envelope had a group id. That made it hard to use SQS fair queues through Wolverine without custom transport code.Solution
Per the issue's recommended option, an opt-in, per-endpoint
EnableFairQueueMessageGroups(), implemented at the envelope-mapping layer (per maintainer steer):ISqsEnvelopeMapper.DetermineGroupId(Envelope)— a new default interface method returningEnvelope.GroupId. Non-breaking for all existing mappers (NServiceBus, MassTransit, CloudEvents, RawJson, SNS); custom mappers can override to source the group id from a header, tenant id, etc.AmazonSqsSubscriberConfiguration.EnableFairQueueMessageGroups()sets a per-endpoint flag onAmazonSqsQueue. Default off, so existing standard-queue users who setGroupId(e.g. viaMessagePartitioning) are unaffected unless they opt in.AmazonSqsQueue.SendMessageAsyncandOutgoingSqsBatch) consult the mapper and gate on FIFO vs the flag:MessageGroupId+MessageDeduplicationId.MessageGroupIdonly; no deduplication semantics.Usage:
Tests
sqs_fair_queue_message_groups(no AWS dependency — exercises the real send mapping viaOutgoingSqsBatch.Request): standard queue with the flag off leavesMessageGroupIdunset; with it on maps the group id; never sets a deduplication id on a standard queue; FIFO still maps both regardless of the flag; and the fluent config flips the flag. 7/7 passing locally.Docs
New Fair Queues page under the SQS guide + sidebar entry.
Notes
4.0.2.14;MessageGroupIdexists on the request/batch-entry types, so no SDK bump.🤖 Generated with Claude Code