-
Notifications
You must be signed in to change notification settings - Fork 23
Closed
Labels
fixed-present-in-next-releaseBug or improvement that's done, it is in the development branch but yet unreleasedBug or improvement that's done, it is in the development branch but yet unreleased
Description
Environment Information
- OS [e.g. Mac, Arch, Windows 10]: macOS 14.5 (23F79)
- Node Version [e.g. 8.2.1]: v18.17.0
- NPM Version [e.g. 5.4.2]: 9.6.7
- C++ Toolchain [e.g. Visual Studio, llvm, g++]: Xcode 14
- confluent-kafka-javascript version [e.g. 2.3.3]:
"@confluentinc/kafka-javascript": "0.1.16-devel"
Steps to Reproduce
When subscribing to topics via a regex, a start-of-string anchor is silently prepended to the regex:
consumer.subscribe({ topics: [/someSuffix$/ })This is equivalent to:
consumer.subscribe({ topics: [/^someSuffix$/ })This happens because the underlying rdkafka library only recognizes regex subscriptions if the start with a ^ character. Instead of silently prepending a ^, I would expect the KafkaJS client behavior to either:
- Throw an error if the regex provided doesn't start with
^, so the developer understands the constraint and can adjust their code accordingly - Preprend
^.*, to ensure we match all topics that matched the user's input regex of/someSuffix$/, as/^.*someSuffix$/.
Metadata
Metadata
Assignees
Labels
fixed-present-in-next-releaseBug or improvement that's done, it is in the development branch but yet unreleasedBug or improvement that's done, it is in the development branch but yet unreleased