Skip to content

MINOR: Use DLQ topic for share group id to enable DLQ.#22436

Merged
apoorvmittal10 merged 4 commits into
apache:trunkfrom
smjn:check-sg-dlq
Jun 2, 2026
Merged

MINOR: Use DLQ topic for share group id to enable DLQ.#22436
apoorvmittal10 merged 4 commits into
apache:trunkfrom
smjn:check-sg-dlq

Conversation

@smjn
Copy link
Copy Markdown
Collaborator

@smjn smjn commented Jun 1, 2026

  • Currently, the code in SharePartition only looks at the broker feature
    config share.version=2 to enable DLQ flow. However, this in not
    correct.
  • Per KIP-1191

A share group can be configured with the name of a topic to be used as
the group's DLQ topic. For a share group with a DLQ topic, when a
record's delivery is rejected by the consumer ...

  • This implies that gating along with DLQ topic being configured on the
    share group is ESSENTIAL for DLQ flows to start.
  • In light of this - appropriate changes have been made in
    SharePartition where the configProvider is leveraged to fetch the DLQ
    topic config applied to the share group. In case the topic name is
    empty, DLQ flow does not execute.
  • Tests have been added to reflect the same and existing tests updated
    with mock DLQ manager to assert on the enqueue calls.

Reviewers: Apoorv Mittal apoorvmittal10@gmail.com

Co-authored-by: Claude noreply@anthropic.com
@smjn smjn requested review from AndrewJSchofield and apoorvmittal10 and removed request for apoorvmittal10 June 1, 2026 08:03
@github-actions github-actions Bot added the triage PRs from the community label Jun 1, 2026
@smjn smjn requested a review from apoorvmittal10 June 1, 2026 08:04
@github-actions github-actions Bot added core Kafka Broker KIP-932 Queues for Kafka group-coordinator labels Jun 1, 2026
Copy link
Copy Markdown
Contributor

@apoorvmittal10 apoorvmittal10 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 PR, a basic question I have. Left as a comment.

public String errorsDLQTopicName(String groupId) {
return manager.groupConfig(groupId)
.map(GroupConfig::errorsDLQTopicName)
.orElse(GroupConfig.ERRORS_DEADLETTERQUEUE_TOPIC_NAME_DEFAULT); // In case no group config
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.

The KIP says following: The broker does not by default automatically create DLQ topics, because that again would give a convoluted way of getting the broker to create a topic with a particular name. hence why do we want to default to a topic name?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@apoorvmittal10 Thanks for the review - the default is just a SENTINEL - its an empty String "". We have the check in SharePartition which looking at empty name does not invoke ARCHIVING flow.

DLQ topic auto creation is controlled via errors.deadletterqueue.auto.create.topics.enable. But both in case of this config being enabled for disabled - user needs to provide a DLQ topic name for a share group on which they want to invoke the DLQ flow. We do not create the topic, if config is set, unless it is specified on the group.

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.

But when there is never default to be supported then why do you need to return the default value from this method?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Ok, will make it optional

@smjn smjn requested a review from apoorvmittal10 June 2, 2026 09:40
Copy link
Copy Markdown
Contributor

@apoorvmittal10 apoorvmittal10 left a comment

Choose a reason for hiding this comment

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

LGTM, one suggestion.

* is present, then the value from the group config is used. Otherwise, empty optional is returned.
*
* @param groupId The group id for which the DLQ topic name is to be fetched.
* @return DLQ topic name for the share group.
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.

Can you please update this as now optional is being returned.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Hi, this is outdated

@apoorvmittal10 apoorvmittal10 merged commit 37d0f70 into apache:trunk Jun 2, 2026
25 checks passed
@github-actions github-actions Bot removed the triage PRs from the community label Jun 3, 2026
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.

2 participants