Skip to content

Conversation

@therepanic
Copy link
Contributor

I chose PulsarListenerAnnotationBeanPostProcessor because I think it's easier to inject PulsarTopicBuilder into it, which I think is better than passing it to MethodPulsarListenerEndpoint later.

Closes: gh-1241

@onobc
Copy link
Collaborator

onobc commented Sep 15, 2025

Sorry it has taken me this long to get back to this PR @therepanic .

So digging into the details during PR review it made me realize that we can do this in a much simpler fashion than I originally hinted towards in the PR description.

Since the DLT feature is only available for consumers AND we are already ensuring FQ topic names in org.springframework.pulsar.core.DefaultPulsarConsumerFactory#ensureTopicNamesFullyQualified we can simply add code here to do the same treatment for consumerBuilder#deadLetterPolicy.deadLetterTopicName.

Something like:

if (builderImpl.getConf().getDeadLetterPolicy() != null) {
	var dlt = builderImpl.getConf().getDeadLetterPolicy().getDeadLetterTopic();
	if (dlt != null) {
		builderImpl.getConf().getDeadLetterPolicy().setDeadLetterTopic(
				this.topicBuilder.getFullyQualifiedNameForTopic(dlt));
	}
}

Also, we should do the same treatment for the DeadLetterPolicy#retryLetterTopic.

Wdyt?

@therepanic
Copy link
Contributor Author

Hi, @onobc!

Sorry for the late reply. Yes, your suggestion is actually much simpler than what I tried to propose. I did what you suggested, also for the reactive version of DefaultPulsarConsumerFactory.

@onobc
Copy link
Collaborator

onobc commented Sep 21, 2025

Thanks for another great contribution @therepanic !

I added a commit to add tests for the dead/retry topics as well.

Closing in favor of 64a9262

@onobc onobc closed this Sep 21, 2025
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.

Allow DeadLetterPolicy.deadLetterTopic to be non-fully-qualified

2 participants