DLQ-3: Add Republish Message Feature with Payload Editing and Diff Preview #3
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.
DLQ-3 Add Republish Message Feature with Payload Editing and Diff Preview
Summary
Implements a new
republish-messagecommand that allows operators to fix failed messages in the DLQ and republish them to their original topics. This feature includes visual diff preview, dry-run mode, and Kafka message headers for observability.Motivation
When messages fail and land in the DLQ, operators need a safe way to:
Previously, this required manual Kafka console operations or custom scripts.
Features
Core Functionality
Observability
id: Message IDcorrelation_id: Correlation ID for distributed tracingrepublished_at: Timestamp of manual interventionDependencies Added
Usage
Basic Usage: Republish with Fixed Payload
Dry Run Mode (Preview Only)
Republish Without Changes (Retry As-Is)
Example Output
cargo run republish-message dlq-user-events 4dcba7cd-0c51-43a8-9cf8-789468c5cecd --dry-run --payload-file fixed_payload.json================================================================= Found message in DLQ: dlq-user-events [DRY RUN MODE] ================================================================= MESSAGE METADATA: ID: 4dcba7cd-0c51-43a8-9cf8-789468c5cecd Correlation ID: a4aea474-65a4-4d85-a05f-42db4aa62a29 Failure Reason: Max retries Retry Count: 5 Original Topic: user-events Moved to DLQ: 2025-10-24T22:36:49Z MESSAGE HEADERS (will be republished as-is): id: 4dcba7cd-0c51-43a8-9cf8-789468c5cecd republished_at: 2025-10-25T08:55:31.117949+00:00 correlation_id: a4aea474-65a4-4d85-a05f-42db4aa62a29 ================================================================= PAYLOAD COMPARISON ================================================================= BEFORE (Current in DLQ): { "action": "test", "data": { "corrupted": true, "email": "malformed" }, "userId": "user-123" } AFTER (From file: fixed_payload.json): { "action": "test", "data": { "corrupted": true, "email": "correct@email.com" }, "userId": "user-123" } DIFF: { "action": "test", "data": { "corrupted": true, - "email": "malformed" + "email": "correct@email.com" }, "userId": "user-123" } ================================================================= PLANNED ACTION: [DRY RUN] → Publish fixed message to: user-events [DRY RUN] → Remove from DLQ: dlq-user-events ================================================================= ================================================================= 🔍 DRY RUN MODE - No changes will be made ================================================================= What would happen: → Message would be published to: user-events → DLQ offset would be committed (message removed from dlq-user-events) To actually perform this operation, run without --dry-run