Skip to content

Commit 67bc400

Browse files
author
Sachin Maheshwari
committed
giving group id to group consumer
1 parent d06dbaf commit 67bc400

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

config/default.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ module.exports = {
99
},
1010
RETRY_COUNTER: 3,
1111
KAFKA_REPOST_COUNT: 5,
12+
KAFKA_URL: process.env.KAFKA_URL,
13+
KAFKA_GROUP_ID: process.env.KAFKA_GROUP_ID || 'ifx-pg-consumer',
14+
KAFKA_CLIENT_CERT: process.env.KAFKA_CLIENT_CERT ? process.env.KAFKA_CLIENT_CERT.replace('\\n', '\n') : null,
15+
KAFKA_CLIENT_CERT_KEY: process.env.KAFKA_CLIENT_CERT_KEY ?
16+
process.env.KAFKA_CLIENT_CERT_KEY.replace('\\n', '\n') : null,
1217
topic_error: {
1318
NAME: 'db.ifxpgmigrate.error',
1419
PARTITION: 0,

src/consumer.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,16 @@ const Promise = require('bluebird');
33
const config = require('config');
44
const logger = require('./common/logger');
55
const healthcheck = require('topcoder-healthcheck-dropin');
6-
const consumer = new Kafka.GroupConsumer();
6+
const options = {
7+
groupId: config.KAFKA_GROUP_ID,
8+
connectionString: config.KAFKA_URL,
9+
ssl: {
10+
cert: config.KAFKA_CLIENT_CERT,
11+
key: config.KAFKA_CLIENT_CERT_KEY
12+
}
13+
};
14+
15+
const consumer = new Kafka.GroupConsumer(options);
716
const {
817
create_consumer_app_log,
918
consumerpg_success_log,

0 commit comments

Comments
 (0)