morganstanley / modern-cpp-kafka

A C++ API for Kafka clients (i.e. KafkaProducer, KafkaConsumer, AdminClient)
Apache License 2.0
331 stars 86 forks source link

Issue subscribing to topic with regex #223

Closed persona94 closed 8 months ago

persona94 commented 10 months ago

I have a topic called

namespace.topic

When I subscribe to it using topic name of ^topic the consumer times out trying to subscribe. Is this not the right way to use regex/wildcards?

jonathan-dev commented 9 months ago

As I understand the '^' is just signaling that the following expression is regex. You are missing a wildcard to match multiple namespaces if that is what you are trying to archive. Or if you want to only match this specific topic also mach the namespace and the dot which you would need to escape because it is any character in regex. The other option would be to get rid of '^' and just use namespace.topic as the topic name to subscribe to. By the way https://regex101.com/ is a nice site to check if you are struggling with the use of regex.

persona94 commented 8 months ago

Thank you. Yes, I did both (namespace.topic) and ^. and they both worked