Skip to content

Implement the retry consumer on EF Core - #5692

Merged
johnsimons merged 2 commits into
masterfrom
john/retries_ef
Aug 4, 2026
Merged

Implement the retry consumer on EF Core#5692
johnsimons merged 2 commits into
masterfrom
john/retries_ef

Conversation

@johnsimons

@johnsimons johnsimons commented Aug 4, 2026

Copy link
Copy Markdown
Member

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 COUNT over claims rather
than a list it carries around.

No schema change. RetryBatches, the single row RetryBatchNowForwarding and
FailedMessageRetries all landed with the producer side, and the claim row is the membership.

Worth knowing while reading it:

  • GetMessagesToStage projects the five columns staging uses, so a claim whose message is
    gone drops out of the join instead of being loaded and discarded, and message bodies are
    never read to stage a batch.
  • MarkBatchAsForwarding is one transaction: the batch to Forwarding with 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 Resolved and Archived,
    so the status write is the cancellation.
  • CompleteForwarding deliberately leaves the claims behind: they are what stops a message
    being staged again before its retry is confirmed. DiscardBatch does delete them, because a
    discarded batch only ever holds claims whose messages are gone.

throw new NotImplementedException();
ExecuteWithDbContext(async dbContext =>
{
var batch = ParseBatchId(batchId);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Base automatically changed from john/retry_consumer to master August 4, 2026 07:06
@johnsimons
johnsimons enabled auto-merge August 4, 2026 07:18
@johnsimons
johnsimons merged commit d86d427 into master Aug 4, 2026
71 of 72 checks passed
@johnsimons
johnsimons deleted the john/retries_ef branch August 4, 2026 07:29
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.

2 participants