is it possible to natively configure a single DLT topic for all failures? #2238
-
I'm using @RetryableTopic to configure retries in their respective queues, but when it falls into DLT I want it sent to a specific topic and only to it, is it possible to configure this natively with spring kafka? Example: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @Watlas, thanks for bringing this up. This is not a feature the framework currently offers, but there's a workaround that might achieve the result you're looking for. You can provide a custom @Bean
public RetryTopicNamesProviderFactory providerFactory() {
return new SuffixingRetryTopicNamesProviderFactory() {
@Override
public RetryTopicNamesProvider createRetryTopicNamesProvider(DestinationTopic.Properties properties) {
if (properties.isDltTopic()) {
return new SuffixingRetryTopicNamesProvider(properties) {
@Override
public String getTopicName(String topic) {
return "my.dlt";
}
};
}
return super.createRetryTopicNamesProvider(properties);
}
};
} Mind that you'll still get one consumer per retryable topic for the dlt. You might have only one I think this is an interesting feature request, if you'd like to open an issue for this I think we can look into having an official, more optimal way of handling this. Just as a note, I see you currently have a few |
Beta Was this translation helpful? Give feedback.
Hi @Watlas, thanks for bringing this up. This is not a feature the framework currently offers, but there's a workaround that might achieve the result you're looking for.
You can provide a custom
RetryTopicNamesProviderFactory
and override thegetTopicName
method when the topic is aDLT
., such as: