ekuiper icon indicating copy to clipboard operation
ekuiper copied to clipboard

Remove redundant topic field from MQTT source messages

Open vkaramanis opened this issue 6 months ago • 2 comments

I've searched existing issues and didn't find similar requests, but please let me know if this has already been discussed.

When using dynamic topics with MQTT sources, the topic field is included in the payload. This appears redundant since the topic is already available in the message context.

I propose automatically removing the topic field from the payload before forwarding the message, as this information is already available and will reduce payload size.

This optimization might also apply to other sources that use dynamic topics(?)

vkaramanis avatar Jun 10 '25 10:06 vkaramanis

In the sink, you can specify the fields in the final output to get rid of the redundant fields. Check the doc https://ekuiper.org/docs/en/latest/guide/sinks/overview.html#common-properties

{
   "actions": [
      {
         "mqtt":{
               "topic": xxx,
               "fields":["field1", "field2"]
           }
      }
    ]
}

ngjaying avatar Jun 11 '25 01:06 ngjaying

That work thanks, sorry I missed that part from the documentation

vkaramanis avatar Jun 16 '25 09:06 vkaramanis