Implement the retry consumer on EF Core - #5692
Merged
Merged
Conversation
rbev
approved these changes
Aug 4, 2026
| throw new NotImplementedException(); | ||
| ExecuteWithDbContext(async dbContext => | ||
| { | ||
| var batch = ParseBatchId(batchId); |
Contributor
There was a problem hiding this comment.
This class is inconsistent between doing the argument parsing/validation upfront or inside ExecuteWithDbContext
|
|
||
| public Task RemoveFromBatch(string uniqueMessageId) => | ||
| throw new NotImplementedException(); | ||
| // Batch ids only ever come from CreateBatch, so anything else is a programming error. |
Contributor
There was a problem hiding this comment.
Should this be a ///<summary>?
| await transaction.CommitAsync(); | ||
| }); | ||
|
|
||
| // Message ids reach this from the API, so an id that is not a message id cannot match a stored |
Contributor
There was a problem hiding this comment.
Should this be a ///<summary>?
The batch lifecycle maps to statements rather than a session: staging is a join from claims to messages, handing a batch to the forwarder is one transaction of updates and deletes plus the pointer row, and the message count is a COUNT over claims.
johnsimons
force-pushed
the
john/retries_ef
branch
from
August 4, 2026 06:54
b0b136d to
3cf499e
Compare
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.
The point of reshaping that contract was that a document session does not survive the
translation to a relational store. With operations instead of a session, the implementation
is mostly statements: staging is a join from claims to messages, handing a batch to the
forwarder is one transaction, and the batch's message count is a
COUNTover claims ratherthan a list it carries around.
No schema change.
RetryBatches, the single rowRetryBatchNowForwardingandFailedMessageRetriesall landed with the producer side, and the claim row is the membership.Worth knowing while reading it:
GetMessagesToStageprojects the five columns staging uses, so a claim whose message isgone drops out of the join instead of being loaded and discarded, and message bodies are
never read to stage a batch.
MarkBatchAsForwardingis one transaction: the batch toForwardingwith its staging id,claims trimmed to what was staged, those messages to
RetryIssued, and the pointer set.There is no "cancel expiration" step, since retention only sweeps
ResolvedandArchived,so the status write is the cancellation.
CompleteForwardingdeliberately leaves the claims behind: they are what stops a messagebeing staged again before its retry is confirmed.
DiscardBatchdoes delete them, because adiscarded batch only ever holds claims whose messages are gone.