"mqtt in" node 'Best Practice'

Just to put the cat among the pigeons - there is a fly in the optimisation ointment (I do love to mix metaphors!). Doing it that way forces node.js to create 3 clones of the incoming message. For large, complex messages, this is actually relatively slow.

Of course, you wouldn't notice in most cases but if you were driving your platform hard or dealing with many messages per second, this could easily become a bottleneck.

One way to get the best of both worlds is to use groups. You can define an environment variable in a group and use that in your mqtt-in node. Meaning that you could then create 3 groups, possibly all using the same function node via link-call's.

If you have common functions, the link-call feature is great.

1 Like