How to use the kafka-node.ConsumerGroupStream 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 theotow / nodejs-kafka-example / consumer.js View on Github external
const streamToObservable = require('stream-to-observable');
const Rx = require('rxjs/Rx');
const async = require('async');
const Bluebird = require('bluebird');
const {
  KAFKA_HOST,
  TOPIC,
  PRODUCER_CONFIG,
  TOPIC_EVENTS,
  PUBSUB_TOPIC,
  MONGO_URL,
  MONGO_COLLECTION
} = require('./config');
const { getPartition, getBusinessRulesOfEvent } = require('./utils');
const client = new kafka.Client();
const consumerGroup = new kafka.ConsumerGroupStream(
  {
    kafkaHost: KAFKA_HOST,
    groupId: 'ExampleTestGroup',
    sessionTimeout: 15000,
    protocol: ['roundrobin'],
    fromOffset: 'latest',
    asyncPush: false,
    autoCommit: false
  },
  TOPIC
);
const producer = new kafka.Producer(client, PRODUCER_CONFIG, getPartition);
var redisClient = require('redis').createClient();
const _ = require('lodash');

var MongoClient = require('mongodb').MongoClient;