Blizzard / Blizzard/node-rdkafka

QUESTION: what format is as regex allowed in topic.blacklist

Open
#1,028 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.2k
Forks
403
PR merge metrics
No merged PRs in 30d

Description

**Environment Information**
- OS: MacOS Ventura
- Node Version [e.g. 8.2.1]: NodeJs 16.x
- NPM Version [e.g. 5.4.2]: NPM 8.x
- node-rdkafka version [e.g. 2.3.3]: 2.3.3

**node-rdkafka Configuration Settings**
I am trying to blacklist all the topics that a consumer is not subscribed to for readability and debug purposes with the `topic.blacklist` option, but are unable to get it to run because I always end up with an Error

`Error: Failed to parse pattern "^(?!.*not\.endswith\.topic$).*": repetition-operator operand invalid
at KafkaConsumer.Client (/System/Volumes/Data/workspace/myservice/node_modules/node-rdkafka/lib/client.js:54:18)`

I am trying to exclude all topics from metadata that do not end with the current assigned topic(s).
for example:

Pattern: `^(?!.*not\.endswith\.topic$).*$`
```
does.not.endswith.topic // no match
not.endswith.topic // no match
this.is.another.topic // match
something // match
else // match
```

I tried a negative lookbehind, negative lookahead, but none works, always the same exception. Am I just too basic for regex? or do I have to be aware what type of regex I can use because the underlying lib is a C lib?

**Additional context**
![image](https://github.com/Blizzard/node-rdkafka/assets/22610610/525032cf-119c-4b84-acb3-c3dc8997d7fd)

Contributor guide

Open the contributing guide

Research direction

Start at node-rdkafka/lib/client.js:54, where the topic.blacklist pattern error is reported, and trace how the option reaches the underlying library. Check the project or underlying library documentation for the accepted pattern syntax and look for related tests. Done means the supported format and the limitation around the reported pattern are documented or clearly answered.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, kafka, node.js
Domain
backend, distributed-systems
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.