How to use the kafka-node.HighLevelConsumer function in kafka-node

To help you get started, we’ve selected a few kafka-node examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github instana / nodejs-sensor / test / tracing / messaging / kafka / consumer.js View on Github external
log('Using Consumer');
  consumer = new kafka.Consumer(
    client,
    [
      {
        topic: 'test'
      }
    ],
    {
      fromOffset: false,
      groupId: uuid()
    }
  );
} else if (process.env.CONSUMER_TYPE === 'highLevel') {
  log('Using HighLevelConsumer');
  consumer = new kafka.HighLevelConsumer(
    client,
    [
      {
        topic: 'test'
      }
    ],
    {
      fromOffset: false,
      groupId: uuid()
    }
  );
} else {
  log('Using ConsumerGroup');
  consumer = new kafka.ConsumerGroup(
    {
      host: process.env.ZOOKEEPER,
github telepat-io / telepat-models / lib / message_queue / kafka_queue.js View on Github external
function(callback) {
			var groupId = self.broadcast ? self.name : channel;
			if (channel) {
				self.kafkaConsumer = new kafka.HighLevelConsumer(self.connectionClient, [{topic: channel}], {groupId: groupId});
				self.kafkaConsumer.on('error', function(err) {
					console.log(err);
				});
			}
			callback();
		},
		function(callback) {
github telepat-io / telepat-worker / lib / kafka_client.js View on Github external
var KafkaClient = function(name, config){
	MessagingClient.call(this, name, config);
	this.connectionClient = kafka.Client(config.host+':'+config.port+'/', name);

	this.kafkaConsumer = new kafka.HighLevelConsumer(this.connectionClient, [{topic: config.topic}], {groupId: config.topic});
	this.kafkaConsumer.on('error', function() {});
	this.kafkaProducer = new kafka.HighLevelProducer(this.connectionClient);
	this.kafkaProducer.on('error', function() {});
};