diff --git a/src/consumer/index.js b/src/consumer/index.js index 0489dcf1d..48d3199e9 100644 --- a/src/consumer/index.js +++ b/src/consumer/index.js @@ -161,14 +161,16 @@ module.exports = ({ for (const subscription of subscriptions) { const isRegExp = subscription instanceof RegExp if (isRegExp) { - const topicRegExp = subscription const matchedTopics = metadata.topicMetadata .map(({ topic: topicName }) => topicName) - .filter(topicName => topicRegExp.test(topicName)) + .filter(topicName => { + const topicRegExp = new RegExp(subscription) + return topicRegExp.test(topicName) + }) logger.debug('Subscription based on RegExp', { groupId, - topicRegExp: topicRegExp.toString(), + topicRegExp: subscription.toString(), matchedTopics, })