DeadLetterPublishingRecoverer 是否期望 .DLT 主题在手前出现

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

我正在使用 spring boot 2.1.7.RELEASE 和 spring-kafka 2.2.8.RELEASE.And 我正在使用 @KafkaListener 注释创建一个消费者,我'使用消费者的所有默认设置,以下设置除外

auto.create.topics.enable = 假

现在我正在尝试结合使用 DeadLetterPublishingRecoverer 和 SeekToCurrentErrorHandler 来处理反序列化错误。

根据 DeadLetterPublishingRecoverer 的 spring-kafka 文档,

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

现在我的问题是,DeadLetterPublishingRecoverer 是否期望 .DLT 主题事先存在,或者它是否可以使用 Adminclient 创建主题(如果不存在?

是;它必须存在;只需添加一个 NewTopic @Bean,自动配置的 Boot KafkaAdmin 就会创建它。