Skip to content

Add ByPropertyNamed grouping rule for partitioned messaging#2253

Merged
jeremydmiller merged 1 commit intomainfrom
issue-2228-property-name-grouping-rule
Mar 2, 2026
Merged

Add ByPropertyNamed grouping rule for partitioned messaging#2253
jeremydmiller merged 1 commit intomainfrom
issue-2228-property-name-grouping-rule

Conversation

@jeremydmiller
Copy link
Member

Summary

  • Adds a new built-in IGroupingRule (PropertyNameGroupingRule) that determines the GroupId by looking for a named property on the message type at runtime
  • Adds ByPropertyNamed(params string[] propertyNames) to the MessagePartitioningRules fluent API
  • Property accessors are compiled via LambdaBuilder and memoized per message type using ImHashMap for performance
  • Supports any property type (string, int, Guid, long, etc.) via ToString(), with null values becoming string.Empty
  • Particularly useful when message contracts are auto-generated (e.g. from .proto files) and cannot implement a marker interface

Closes #2228

Test plan

  • 11 unit tests covering string, int, Guid, and long property types
  • Tests for null property values, missing properties, property name priority, memoization, and explicit GroupId precedence
  • All 28 existing partitioning tests continue to pass
  • Documentation sample compiles successfully

🤖 Generated with Claude Code

Closes #2228

Built-in IGroupingRule that discovers a named property on message types at runtime
and uses its value as the GroupId. Property accessors are compiled via LambdaBuilder
and memoized per message type. Supports string, int, Guid, long, and any property
type via ToString().

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.

Built-in IGroupingRule to declare a specific property name as the GroupId for use with partitioned/sequential processing

1 participant