Skip to content

Redox retry and email handling#117

Open
toddkazakov wants to merge 2 commits into
mainfrom
tk-redox-retry-and-email-handling
Open

Redox retry and email handling#117
toddkazakov wants to merge 2 commits into
mainfrom
tk-redox-retry-and-email-handling

Conversation

@toddkazakov

Copy link
Copy Markdown
Collaborator

No description provided.

Redox order processing retried far more than the configured 3 attempts.
The inner RetryingConsumer caps attempts, but on exhaustion it returned
the error, so the offset was never committed and the fault-tolerant
consumer restarted and redelivered the message - reprocessing in batches
of 3 indefinitely (a poison-message loop).

Add an opt-in CommitOnFailure option to RetryOptions that logs and
swallows the final error once retries are exhausted, so the offset is
committed and the message is not redelivered. Enable it for the redox
consumers, which already use a 3-attempt RetryOptions.

Thread the existing zap logger into RetryingConsumer so the give-up is
logged with structured context.
GetEmailAddressFromOrder only ever read the first entry of the email
list and returned a hard error when it failed to parse, which caused
order processing to fail on a single invalid email.

Iterate the full patient/guarantor email list and return the first
address that parses, skipping invalid or non-string entries. When none
are valid, proceed without an email instead of erroring.
@toddkazakov
toddkazakov force-pushed the tk-redox-retry-and-email-handling branch from 3e91892 to 2a73213 Compare June 4, 2026 16:03
Comment thread cdc/retry.go
)
if err != nil && r.opts.CommitOnFailure {
// Give up and commit the offset so the message is not redelivered.
r.logger.Warnw("giving up on message and committing offset", "offset", cm.Offset, "attempts", r.opts.Attempts, zap.Error(err))

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.

I think it would make sense if we monitored the rate of these errors and alerted if they were elevated beyond some threshold.

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