Spring Boot Kafka @SendTo无法读取kafka_replyTopic头

huangapple go评论88阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2020年9月2日 17:23:49
  • 转载请务必保留本文链接:https://go.coder-hub.com/63702572.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定