Skip to content

Commit

Permalink
Add updateMetadata configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
thspinto committed May 22, 2018
1 parent b4e58ee commit 2cc534f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "quintoandar-kafka",
"version": "0.0.8",
"version": "0.0.9",
"description": "Default Kafka NodeJS lib for QuintoAndar",
"main": "src/main.js",
"dependencies": {
Expand Down
3 changes: 2 additions & 1 deletion src/node-kafka-consumer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class KafkaConsumer {
_.defaults(this.configs, { fromOffset: 'latest' });
_.defaults(this.configs, { outOfRangeOffset: 'latest' });
_.defaults(this.configs, { fetchMaxBytes: 1024 * 1024 });
_.defaults(this.configs, { updateMetadata: 90 * 1000 });
}

validateConfigs() {
Expand Down Expand Up @@ -44,7 +45,7 @@ class KafkaConsumer {
this.consumer.commit(msg, true);
});
});
setInterval(this.refreshMetadata.bind(this), this.sessionTimeout + 30000);
setInterval(this.refreshMetadata.bind(this), this.updateMetadata);
logger.info('ConsumerGroupStream started');
}

Expand Down
3 changes: 2 additions & 1 deletion tests/node-kafka-consumer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ describe('Kafka Consumer', () => {
asyncPush: false,
fromOffset: 'latest',
outOfRangeOffset: 'latest',
fetchMaxBytes: 1024 * 1024
fetchMaxBytes: 1024 * 1024,
updateMetadata: 90000
};

const topics = ['Test'];
Expand Down

0 comments on commit 2cc534f

Please sign in to comment.