How to trigger two separate functions based on mqtt topic

I have two MQTT topics ending with DATA and EVENT,
e.g. device/deviceId/DATA and device/deviceId/Event

How can I perform two separate internal flows based on DATA and EVENT?
Current I able to do by parsing topic in function node and than using switch node. Is there any better way to do so?

Have the mqtt-in node use the topic device/deviceId/# and feed that to a switch node that checks if the topic contained DATA and check if it contains Event

Then you can connect the two outputs to the two flows you want

Or just have two MQTT inputs set to each topic.

1 Like