Closed turhan-huseynov closed 5 years ago
Looks like on new examples of kafka, we dont use this line
kafka: require('kafka-node')
it fixed my problem.
@Tribot91 can you elaborate? Running into the same issue when trying to use kafka-node v4+
Are you saying just remove the kafka: require('kafka-node')
and it will work?
@Tribot91 can you point me to where in the docs you found this fix?
Environment
Sample code:
Questions?
Mosca gives this error:
So i opened '/home/x/Desktop/broker/node_modules/mosca/node_modules/ascoltatori/lib/kafka_ascoltatore.js' and after looking at the line below found out that the problem is related with kafka-node version:
When i removed this._opts.kafka, it started to work fine. Then i printed both i figured out that the new version does not have Client constructor in it. Here is my print result: this._opts.kafka (kafka-node v4.0.1 latest) returns HighLevelProducer which does not have Client, on the other hand require("kafka-node") (v0.5.9) returns HighLevelConsumer. I could make Kafka to work with older version but i think it would be only a quick fix, so i hope somebody can lead me with a proper solution.