Dushan
Dushan

Reputation: 1565

What is the default kafka retention time for dead letter topics

Hi i'm using Spring kafka and i configure my kafka by providing consumerFactory and producerFactory beans. I have configure my kafka to use dead letter topic if there's any issue when processing. Below are my annotation for error handling part.

@RetryableTopic(
        attempts = "#{'${kafka.consumer.retryable.attempts}'}",
        backoff = @Backoff(delay = 1000, multiplier = 2.0),
        autoCreateTopics = "false",
        topicSuffixingStrategy = TopicSuffixingStrategy.SUFFIX_WITH_INDEX_VALUE,
        include = {RetryableException.class})

According to the above configuration, i had to create some topics. Those are -retry-0, -retry-1, -dlt. What i'm wondering is what is the default retention time for each of these topics (Specially dlt topic) ?

I know that we can give a custom retention time by providing –config retention.ms. Just want to know is there any configuration in spring where i can give that retention time as well (For dead letter topic).

Upvotes: 0

Views: 666

Answers (1)

Gary Russell
Gary Russell

Reputation: 174779

Spring does not manage any topic attributes automatically; you can set the retention.ms in a NewTopic bean.

The default depends on your broker config; its default is 168 hours (one week).

https://kafka.apache.org/documentation/#brokerconfigs_log.retention.hours

Upvotes: 2

Related Questions