Have a basic example that works like a charm for 1 consumer. It receives the messages. But adding one additional consumer will be ignored.
let kafka = require('kafka-node');
let client = new kafka.Client();
let producer = new kafka.Producer(client);
let consumer1 = new kafka.Consumer(client,[ {topic: 'topic1', partition: 0}]);
let consumer2 = new kafka.Consumer(client,[ {topic: 'topic2', partition: 0}]);
producer.on('ready', function () {
producer.send([{topic:'topic1', messages: 'topic 1 msg' ], (err,data)=>{
console.log(err,'1 sent');
});
producer.send([{topic:'topic2', messages: 'topic 1 msg'}], (err,data)=>{
console.log(err, '2 sent');
});
});
producer.on('error', function (err) {
console.log('err', err);
})
consumer1.on('message',(message) =>{
console.log(11, message);
});
consumer2.on('message',(message) =>{
console.log(22, message);
})
The issue that event with '22' for consumer2 never fires. Data on that topic exist if I check it with command line tools