Said Savci
Said Savci

Reputation: 858

Configuring a single and custom retry-topic for non-blocking retries in Spring Kafka

I'm testing the new feature in Spring Kafka 2.7 for non-blocking retries. I have a fixed retry-topic that is already given and named after a certain scheme prescribed by my company, and no DLT topic. I want to configure a retry policy with a fixed backoff policy, no DLT, but with my single retry-topic. I couldn't find a way to configure this with RetryTopicConfiguration. In RetryTopicConfiguration, the name of the retry-topic is constructed by appending a suffix (depending on the TopicSuffixingStrategy) to the main topic name. Is there a way to set the retry-topic directly?

Upvotes: 0

Views: 1367

Answers (1)

Gary Russell
Gary Russell

Reputation: 174554

See the documentation.

Custom naming strategies

More complex naming strategies can be accomplished by registering a bean that implements RetryTopicNamesProviderFactory. The default implementation is SuffixingRetryTopicNamesProviderFactory and a different implementation can be registered in the following way:

@Bean
public RetryTopicNamesProviderFactory myRetryNamingProviderFactory() {
    return new CustomRetryTopicNamesProviderFactory();
}

Upvotes: 1

Related Questions