fix(kafka): preserve offset when DLQ publish fails (#69)#108
Merged
Conversation
processOne previously called MarkMessage unconditionally after attempting to send a failed message to the DLQ, so a transient DLQ-topic outage silently lost the message. The offset is now only marked when processing succeeded or the DLQ publish succeeded; DLQ-publish failures leave the offset uncommitted so the consumer redelivers on the next session. A new metric counts DLQ publish failures. Closes F-011.
7 tasks
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.
Summary
processOneno longerMarkMessages whensendToDLQreturns an error; the offset stays uncommitted so Kafka redelivers on the next session / pod restart.sendToDLQnow returns an error from broker publish failures (marshal failures and the no-producer-configured branch still return nil since retrying does not help).arcade_kafka_dlq_publish_failures_total{topic}so operators can alert on DLQ outages.processWithRetrytests still pass.Closes #69
Test plan
go build ./...go vet ./...go test ./kafka/... -racegolangci-lint run ./kafka/... ./metrics/...(0 issues)