Skip to content

MINOR: Correct exception naming and preserve original headers in DLQ#21370

Merged
lucasbru merged 3 commits intoapache:trunkfrom
unknowntpo:fix-dlq-headers
Jan 30, 2026
Merged

MINOR: Correct exception naming and preserve original headers in DLQ#21370
lucasbru merged 3 commits intoapache:trunkfrom
unknowntpo:fix-dlq-headers

Conversation

@unknowntpo
Copy link
Copy Markdown
Contributor

@unknowntpo unknowntpo commented Jan 29, 2026

This patch fixed two mismatch between
KIP-1034
and the actual implementation:

  • Incorrect value of HEADER_ERRORS_EXCEPTION_NAME, it should be the
    name of the thrown exception, not exception's String representation.
  • Original headers from record that causes exception should be added to
    dlq record headers.

References:

KIP-1034

Reviewers: Lucas Brutschy lbrutschy@confluent.io

Per KIP-1034 spec, the __streams.errors.exception header should contain
the "Name of the thrown exception" (class name), not the toString() output.

Changed e.toString() to e.getClass().getName() in ExceptionHandlerUtils.
@github-actions github-actions bot added triage PRs from the community streams small Small PRs labels Jan 29, 2026
@unknowntpo unknowntpo marked this pull request as ready for review January 29, 2026 13:51
@chia7712 chia7712 changed the title [MINOR] Fix DLQ headers MINOR: Fix DLQ headers Jan 29, 2026
@chia7712 chia7712 changed the title MINOR: Fix DLQ headers MINOR: Correct exception naming and preserve original headers in DLQ Jan 29, 2026
@chia7712 chia7712 requested review from cadonna and lucasbru January 29, 2026 13:57
Copy link
Copy Markdown
Member

@lucasbru lucasbru left a comment

Choose a reason for hiding this comment

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

Thanks, for the fix! LGTM

@lucasbru lucasbru merged commit 0144bf1 into apache:trunk Jan 30, 2026
35 of 40 checks passed
@chia7712
Copy link
Copy Markdown
Member

> Task :streams:checkstyleMain
[ant:checkstyle] [ERROR] /home/chia7712/project/kafka/streams/src/main/java/org/apache/kafka/streams/errors/internals/ExceptionHandlerUtils.java:89:25: Variable 'header' should be declared final. [FinalLocalVariable]

@unknowntpo Would you mind opening a PR against the 4.2 branch? We had to disable FinalParameters in #20726 because the new Checkstyle has stricter enforcement.

@unknowntpo
Copy link
Copy Markdown
Contributor Author

@chia7712 Sure, I'll do it ASAP.

unknowntpo added a commit to unknowntpo/kafka that referenced this pull request Jan 31, 2026
…pache#21370)

This patch fixed two mismatch between

[KIP-1034](https://cwiki.apache.org/confluence/display/KAFKA/KIP-1034%3A+Dead+letter+queue+in+Kafka+Streams#KIP1034:DeadletterqueueinKafkaStreams-ProposedChanges)
and the actual implementation:

- Incorrect value of `HEADER_ERRORS_EXCEPTION_NAME`, it should be the
name of the thrown exception, not exception's String representation.
- Original headers from record that causes exception should be added to
dlq record headers.

References:
- apache#17942 (comment)
- apache#17942 (comment)
-

[KIP-1034](https://cwiki.apache.org/confluence/display/KAFKA/KIP-1034%3A+Dead+letter+queue+in+Kafka+Streams#KIP1034:DeadletterqueueinKafkaStreams-ProposedChanges)

Reviewers: Lucas Brutschy <lbrutschy@confluent.io>
unknowntpo added a commit to unknowntpo/kafka that referenced this pull request Jan 31, 2026
…pache#21370)

This patch fixed two mismatch between

[KIP-1034](https://cwiki.apache.org/confluence/display/KAFKA/KIP-1034%3A+Dead+letter+queue+in+Kafka+Streams#KIP1034:DeadletterqueueinKafkaStreams-ProposedChanges)
and the actual implementation:

- Incorrect value of `HEADER_ERRORS_EXCEPTION_NAME`, it should be the
name of the thrown exception, not exception's String representation.
- Original headers from record that causes exception should be added to
dlq record headers.

References:
- apache#17942 (comment)
- apache#17942 (comment)
-

[KIP-1034](https://cwiki.apache.org/confluence/display/KAFKA/KIP-1034%3A+Dead+letter+queue+in+Kafka+Streams#KIP1034:DeadletterqueueinKafkaStreams-ProposedChanges)

Reviewers: Lucas Brutschy <lbrutschy@confluent.io>
@github-actions github-actions bot removed the triage PRs from the community label Jan 31, 2026
chia7712 pushed a commit that referenced this pull request Jan 31, 2026
…21378)

This is a backport of PR #21370, with an additional checkstyle fix
(adding a `final` keyword to make checkstyle works in 4.2 branch).

---

This patch fixed two mismatch between


[KIP-1034](https://cwiki.apache.org/confluence/display/KAFKA/KIP-1034%3A+Dead+letter+queue+in+Kafka+Streams#KIP1034:DeadletterqueueinKafkaStreams-ProposedChanges)
and the actual implementation:

- Incorrect value of `HEADER_ERRORS_EXCEPTION_NAME`, it should be the
name of the thrown exception, not exception's String representation.
- Original headers from record that causes exception should be added to
dlq record headers.

References:
- #17942 (comment)
- #17942 (comment) 
-
[KIP-1034](https://cwiki.apache.org/confluence/display/KAFKA/KIP-1034%3A+Dead+letter+queue+in+Kafka+Streams#KIP1034:DeadletterqueueinKafkaStreams-ProposedChanges)

Reviewers: Lucas Brutschy <lbrutschy@confluent.io>, Chia-Ping Tsai
<chia7712@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants