我尝试使用Node和franz-kafka模块从Kafka读取。
我已按照https://www.npmjs.com/package/franz-kafka上的示例进行操作。
我制作了以下内容:
var Kafka = require('franz-kafka')
var kafka = new Kafka({
zookeeper: ['{my zookeeper ip}:2181'],
logger: console
})
kafka.connect(function () {
// topics are Streams
var foo = kafka.topic('foo')
// consume with a pipe
foo.pipe(process.stdout)
// or with the 'data' event
foo.on('data', function (data) { console.log(data) })
// resume your consumer to get it started
foo.resume()
// don't forget to handle errors
foo.on('error', function (err) { console.error("STAY CALM") })
}
)
当我运行我的服务器时,收到以下错误:
assert.js:93
throw new assert.AssertionError({
^
AssertionError: number too small
at toDouble (/home/stefano/TestKafkaNode/node_modules/franz-kafka/node_modules/int53/index.js:49:3)
at Object.int53.readInt64BE (/home/stefano/TestKafkaNode/node_modules/franz-kafka/node_modules/int53/index.js:62:9)
at Function.ZnodeStat.parse (/home/stefano/TestKafkaNode/node_modules/franz-kafka/node_modules/zkjs/protocol/znode-stat.js:20:29)
at GetDataResponse.parse (/home/stefano/TestKafkaNode/node_modules/franz-kafka/node_modules/zkjs/protocol/get-data.js:32:30)
at Receiver.read (/home/stefano/TestKafkaNode/node_modules/franz-kafka/node_modules/zkjs/receiver.js:91:16)
at Receiver.streamReadable (/home/stefano/TestKafkaNode/node_modules/franz-kafka/node_modules/zkjs/receiver.js:112:8)
at Client.emit (events.js:92:17)
at emitReadable_ (_stream_readable.js:427:10)
at emitReadable (_stream_readable.js:423:5)
at readableAddChunk (_stream_readable.js:166:9)
我在google上搜索过没有任何结果。
有人能帮助我吗?