Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MQTT source: how to keep track of origin topic when using wildcard subscriptions #1307

Open
dberardo-com opened this issue Jul 21, 2024 · 2 comments

Comments

@dberardo-com
Copy link

i have an mqtt source connector and it is subscribed correctly to a wildcard topic. the connector receives messages from all topics and writes them into a single kafka topic. my question is:

  1. how can i keep track of the original MQTT topic the message was sent to? ideally i would like to include the topic name in the kafka message body and as part of its key as well
  2. is it possible to write the messages within new kafka topics using the same name as the original MQTT topic ? e.g. mqttTopics/# ---> message written in kafka topic mqttTopics.myTopic.mySubtopic .. .etc ?
@stheppi
Copy link
Contributor

stheppi commented Jul 23, 2024

Hi @dberardo-com ,

At the moment there is no option of doing that. What you have suggested on point 2, regarding the output topic is potentially your requirement.

What can be done quickly, is to add the source Mqtt topic/queue to be added as a header, and then use an SMT to use the header , adapt to your needs, and set the new target topic.

We welcome contributions if you are up for it.

@dberardo-com
Copy link
Author

i have managed to achieve partly the point 2 of my requirements above by doing:

INSERT INTO $ SELECT * FROM $share/kafka-prod/#

but it would be nice to know if the created topic could be renamed during creation.

What can be done quickly, is to add the source Mqtt topic/queue to be added as a header,

how to achieve this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants