我试着用node和franzkafka模块来阅读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)
我在谷歌上搜索过,没有任何结果。
有人能帮我吗?
暂无答案!
目前还没有任何答案,快来回答吧!