Skip to content

Wire ResequencerSaga ShouldProceed() into saga code generation#2298

Merged
jeremydmiller merged 3 commits intomainfrom
saga-sequencer
Mar 12, 2026
Merged

Wire ResequencerSaga ShouldProceed() into saga code generation#2298
jeremydmiller merged 3 commits intomainfrom
saga-sequencer

Conversation

@jeremydmiller
Copy link
Member

@jeremydmiller jeremydmiller commented Mar 12, 2026

Summary

  • Add ShouldProceedGuardFrame that wraps saga handler calls with a ShouldProceed() guard for ResequencerSaga<T> types, implementing the Resequencer EIP pattern
  • Modify SagaChain to detect ResequencerSaga<T> and thread the message variable through to DetermineSagaExistsSteps for guard frame generation
  • Fix ShouldProceed to allow re-published messages (Order <= LastSequence) through the guard instead of re-queuing them
  • Add SequencedMessage detection to inferred message group detection — messages implementing SequencedMessage automatically use Order as the group id for partitioned sequential messaging
  • Add documentation in the Sagas guide with code sample and concurrency recommendation
  • Update partitioning docs to list SequencedMessage as an inferred grouping source

Test plan

  • 5 in-memory saga tests pass (CoreTests): in-order handling, out-of-order queuing, gap filling, null/zero order bypass
  • 4 Marten end-to-end tests pass (MartenTests): same patterns with Marten persistence
  • All 62 existing saga tests pass with zero regressions
  • 3 new SequencedMessage grouping rule tests pass
  • All 66 partitioning tests pass with zero regressions

🤖 Generated with Claude Code

jeremydmiller and others added 3 commits March 12, 2026 11:03
Add ShouldProceedGuardFrame that wraps handler calls with a
ShouldProceed() guard for ResequencerSaga<T> types. The guard
ensures messages are processed in order while always persisting
the saga state (Pending list and LastSequence may change even
when the handler is skipped).

Also fix ShouldProceed to allow re-published messages (Order <=
LastSequence) through the guard instead of re-queuing them.

Includes in-memory tests (CoreTests), Marten end-to-end tests,
and documentation with link to the EIP Resequencer pattern.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…aging

Detect SequencedMessage types in MaybeInferGrouping and use Order as the
group id for partitioned sequential messaging. Messages with null Order
get a random group id so they distribute independently.

Update partitioning and saga docs to recommend using partitioned
sequential messaging with ResequencerSaga for concurrency management.

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