kubemq-io / kubemq-sources

KubeMQ Sources connects external systems and cloud services with KubeMQ message queue broker.
Apache License 2.0
18 stars 8 forks source link

Feature request: Include original topic name or dynamic topic names #8

Closed rjbaat closed 4 years ago

rjbaat commented 4 years ago

I have a source listing to a catch all mqtt topic. Like:

data/+/json where the + sign is the device id. FE data/device_A/json data/device_B/json

Based on the topics i want to route them. is it possible to add the original topic to the message? Atm i only get the payload of the message. But then i dont know from what device it was coming from. Is it possible to route them to a similar topic in kubemq like: data/device_A/json And is there a wildcard topic for kubemq similar to mqtt. Like FE: data/# or data/+/json

Thnx

kubemq commented 4 years ago

Hi @rjbaat , Thank you for the feedback!

I have released version v0.3.19 to support your request. Every MQTT message will put data to KubeMQ Target as follows:

  1. Payload will be on the Body ( As before)
  2. MQTT message metadata such, id, topic, QoS, duplicate, and retained will be mapped to the metadata field in the KubeMQ message. ( as a json of map[string] of string) Give it a try and let me know.

As for dynamic routing to kubemq topic, it's possible and we will try to bring this on the coming versions. at this time, you can set a subscriber to get all the messages and route them as your needs.

As for the wildcard topic, yes, Events message pattern supports that.

kubemq commented 4 years ago

@rjbaat , Dynamic mapping was added to release v0.3.20 check out the readme for mqtt for the dynamic_mapping value