Skip to content

Add global partitioning for cluster-wide GroupId concurrency control#2273

Merged
jeremydmiller merged 2 commits intomainfrom
feature/global-partitioning
Mar 9, 2026
Merged

Add global partitioning for cluster-wide GroupId concurrency control#2273
jeremydmiller merged 2 commits intomainfrom
feature/global-partitioning

Conversation

@jeremydmiller
Copy link
Member

Summary

  • Adds global partitioning that ensures no two messages with the same GroupId execute concurrently across an entire application cluster
  • Pairs external transport topologies with companion local durable queues — external listeners relay messages to local queues for sequential processing by GroupId
  • Smart routing via GlobalPartitionedRoute checks local listener ownership and shortcuts directly to local queues when the exclusive listener is active on the current node
  • GlobalPartitionedInterceptor on non-paired external listeners re-routes matching messages through Wolverine's routing for proper partition assignment
  • All endpoints (external + local) are forced to EndpointMode.Durable for reliability
  • UseSharded* extension methods added to all 8 transports: RabbitMQ, Amazon SQS, Azure Service Bus, Kafka, NATS, Redis, Pulsar, GCP Pub/Sub
  • New PartitionedMessageTopology classes for Azure Service Bus, Kafka, NATS, Redis, Pulsar, and GCP Pub/Sub

Core infrastructure

  • GlobalPartitionedMessageTopology — orchestrates external + companion local topologies with message subscription matching
  • GlobalPartitionedRouteIMessageRoute with local-vs-remote routing logic
  • GlobalPartitionedReceiverBridgeIReceiver that forwards from external listener to companion local queue
  • GlobalPartitionedInterceptorIReceiver decorator for non-paired listeners that re-publishes matching messages

Usage

opts.MessagePartitioning.GlobalPartitioned(gp =>
{
    gp.UseShardedRabbitQueues("orders", 5);
    gp.Message<OrderPlaced>();
    gp.Message<OrderShipped>();
});

Test plan

  • 34 unit tests covering GlobalPartitionedMessageTopology, GlobalPartitionedRoute, GlobalPartitionedReceiverBridge, GlobalPartitionedInterceptor, and MessagePartitioningRules
  • All 8 transport projects compile successfully
  • Integration tests with actual message brokers (requires docker infrastructure)

🤖 Generated with Claude Code

jeremydmiller and others added 2 commits March 9, 2026 09:27
…and HTTP endpoints

Support Validate/ValidateAsync methods returning IEnumerable<string>, string[],
Task<string[]>, or ValueTask<string[]> as a lower-ceremony validation option.
For message handlers, validation failures are logged and processing aborts.
For HTTP endpoints, a ProblemDetails 400 response is returned.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…Id execute concurrently across an application cluster

Pairs external transport topologies (RabbitMQ, SQS, Azure Service Bus, Kafka, NATS, Redis, Pulsar, GCP Pub/Sub) with companion local durable queues. External listeners relay messages to local queues for sequential processing. Smart routing checks local listener ownership to shortcut directly to local queues when possible.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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