Skip to content

Instantly share code, notes, and snippets.

@thakursaurabh1998
Created August 9, 2020 15:28
Show Gist options
  • Save thakursaurabh1998/0c42e0c9cd760d44e1c835a7251489fd to your computer and use it in GitHub Desktop.
Save thakursaurabh1998/0c42e0c9cd760d44e1c835a7251489fd to your computer and use it in GitHub Desktop.
const { ConsumerGroup } = require('kafka-node');
const options = {
kafkaHost: 'broker:9092',
groupId: 'order-service',
fetchMaxBytes: 100 * 1024, // 100 KB
autoCommit: false,
};
const consumer = new ConsumerGroup(options, 'OrderTopic');
consumer.on('message', (data) => {
consumer.pause();
// queue data available here
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment