Search code examples
spring-kafka

Does DeadLetterPublishingRecoverer expect the .DLT topic to be present before hand


I'm using spring boot 2.1.7.RELEASE and spring-kafka 2.2.8.RELEASE.And I'm using @KafkaListener annotation to create a consumer and I'm using all default settings for the consumer except below one

auto.create.topics.enable = false

Now I'm trying to use DeadLetterPublishingRecoverer in conjunction with SeekToCurrentErrorHandler to handle deserialization errors.

As per the spring-kafka documentation of DeadLetterPublishingRecoverer,

By default, the dead-letter record is sent to a topic named .DLT (the original topic name suffixed with .DLT) and to the same partition as the original record

Now my question is, Does the DeadLetterPublishingRecoverer expect the .DLT topic be present before hand or can it create the topic using Adminclient (if not present?


Solution

  • Yes; it must exist; just add a NewTopic @Bean and the auto-configured Boot KafkaAdmin will create it.