英文:
Spring Boot Kafka @SendTo can't read kafka_replyTopic header
问题
我在Spring Boot应用程序中的消费者接收器上使用了没有参数的@SendTo注解。接收到的消息包含头部"Kafka_replyTopic",但@SendTo无法读取它,导致Kafka在发送回复时抛出异常:
监听器失败;嵌套异常是java.lang.IllegalStateException: 没有主题头部,需要默认主题。
英文:
I'm using @SendTo annotation with no args on a consumer receiver in spring boot application. The received message contains header "Kafka_replyTopic", but the @SendTo cannot read it and kafka throws an exception on sending the reply:
Listener failed; nested exception is java.lang.IllegalStateException: With no topic header, a defaultTopic is required
答案1
得分: 0
我通过将消费者应用程序中的spring-boot-starter-parent版本设置为与生产者应用程序中的版本相同(v. 2.3.2.RELEASE)来解决了这个问题。
我不知道问题是否出在消费者应用程序中的旧版本本身(v. 2.2.6.RELEASE),还是它的版本与生产者应用程序的版本不同。
英文:
I solved it by setting the spring-boot-starter-parent version in the consumer application the same as that in the producer application (v. 2.3.2.RELEASE)
I don't know if the problem was with the old version itself (v. 2.2.6.RELEASE) in the consumer application or was that its version was different from that of the producer application.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论