报错 Exception thrown when sending a message with key= and payload='1' to topic test

本地环境 springboot集成kafka发消息报错Exception thrown when sending a message with key='' and payload='1' to topic test

org.apache.kafka.common.errors.TimeoutException: Expiring 1 record(s) for test-0 due to 30049 ms has passed since batch creation plus linger time

解决办法:

修改kafka配置文件server.properties

listeners=PLAINTEXT://{内网ip}:9092

advertised.listeners=PLAINTEXT://{外网ip}:9092

重新启动本地项目,发送消息成功,并且DEBUG 日志级别下会打印心跳日志
 

报错:  kafka Exception thrown when sending a message with key='null'

org.springframework.kafka.support.LoggingProducerListener [76] - Exception thrown when sending a message with key=’null’ and payload=’2017-11-14 15:36:53|iZbp1115ogry6vyp418vplZ|192.168.3.1|{“token”:”708037c594e04850bfd48f82fa862dd…’ to topic
解决:

kafka Exception thrown when sending a message with key='null'_夜华_的博客-CSDN博客

/etc/hosts中加主机名和ip 映射

配置hosts
10.10.3.11 bj-6-dqy-msg-queue01
10.10.3.12 bj-6-dqy-msg-queue02
10.10.3.13 bj-6-dqy-msg-queue03

127.0.0.1 bj-6-dqy-msg-queue01

还有检查一下kafka集群是否正常, 网络是否通/ 我就是网络不通  telnet 失败, 最后去掉防火墙后就正常了

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐