moscajs / mosca

MQTT broker as a module
mosca.io
3.2k stars 508 forks source link

Kafka ascoltatore is not using HighLevelConsumer #573

Closed svarkey closed 7 years ago

svarkey commented 7 years ago

I have noticed the Kafka client as part of this integration is using the Simple consumer. As part of our project, we need to use HighLevelConsumer to get the queue functionality from Kafka.

To achieve the above we need to modify the _startConn method in kafka_ascoltatore.js something like this

if (useHighLevelConsumer) {
            that._consumer = new HighLevelConsumer(that._consumerClient, subscriptions, {
                groupId: groupId,
                fromOffset: true, autoCommit: false, encoding: "buffer"
            });
        } else {
            that._consumer = new Consumer(that._consumerClient, subscriptions, {
                groupId: groupId,
                fromOffset: true, autoCommit: false, encoding: "buffer"
            });
        }
mcollina commented 7 years ago

Would you like to send us a pull request?

What's the difference between a HighLevelConsumer and a Consumer?