我已根据以下说明在本地开发人员机器上安装了kafka:https://kafka.apache.org/documentation/#quickstart
我能够在运行.sh文件时生成和使用消息,如上面链接中所述。
但是,当尝试使用kafkajs从nodejs应用程序连接到kafka时,kafka服务器中会记录以下错误:
[2020-05-15 09:07:41,210] WARN [SocketServer brokerId=0] Unexpected error from /127.0.0.1; closing connection (org.apache.kafka.common.network.Selector)
org.apache.kafka.common.network.InvalidReceiveException: Invalid receive (size = 369295617 larger than 104857600)
at org.apache.kafka.common.network.NetworkReceive.readFrom(NetworkReceive.java:105)
at org.apache.kafka.common.network.KafkaChannel.receive(KafkaChannel.java:448)
at org.apache.kafka.common.network.KafkaChannel.read(KafkaChannel.java:398)
at org.apache.kafka.common.network.Selector.attemptRead(Selector.java:678)
at org.apache.kafka.common.network.Selector.pollSelectionKeys(Selector.java:580)
at org.apache.kafka.common.network.Selector.poll(Selector.java:485)
at kafka.network.Processor.poll(SocketServer.scala:861)
at kafka.network.Processor.run(SocketServer.scala:760)
at java.lang.Thread.run(Thread.java:748)
生产商代码如下:
const kafka = new Kafka({
brokers: ['localhost:9092'],
ssl: { rejectUnauthorized: false }
})
const producer = kafka.producer();
await producer.connect()
你知道为什么它不是在nodejs代码中工作,而是在运行.sh文件时工作吗?
暂无答案!
目前还没有任何答案,快来回答吧!