springboot集成kafka发消息报Exception thrown when sending a message with key= and payload=‘1’ to topic test

匿名 (未验证) 提交于 2019-12-03 00:22:01

本地环境 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


错误排查:


Connection with /{内网ip} disconnected java.net.ConnectException: Connection timed out: no further information  Initiating connection to node 0 at {内网ip}:9092.

由此可见错误原因是本地无法访问服务器内网ip导致


解决办法:

修改kafka配置文件server.properties

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

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

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!