Skip to content

Commit

Permalink
Merge pull request #470 from Collaborne/pr/prevent-subscription-chang…
Browse files Browse the repository at this point in the history
…e-for-consumer

Prevent changes in the subscriptions for running consumers
  • Loading branch information
Nevon committed Aug 18, 2019
2 parents 8feb245 + 4782c5a commit e21c04d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/consumer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ module.exports = ({
* @return {Promise}
*/
const subscribe = async ({ topic, fromBeginning = false }) => {
if (consumerGroup) {
throw new KafkaJSNonRetriableError('Cannot subscribe to topic while consumer is running')
}

if (!topic) {
throw new KafkaJSNonRetriableError(`Invalid topic ${topic}`)
}
Expand Down

0 comments on commit e21c04d

Please sign in to comment.