Passing values through nodes that removes everything

I know it depends on implementation of each individual node how they handle other members of msg. But some nodes I work with discards everything and only outputs for example topic & payload. It's super annoying when you want/need to keep extra info attached to the message. For example generating some statistics off mbus, I use cronplus node to inject at regular intervals. Then a function node to add a clean timestamp for current time (epoc with seconds and milliseconds set to zero). Then send msg to mbus. Which spends a random amount of time, then only outputs topic and payload. Timestamp is now lost, so can only be applied afterwards, at which the time is not guaranteed to be accurate due to time taken to read the data.

Is there any easy fix to re-apply data to msg? I know context can do it but would easily become messy and error prone (the output message wouldn't have necessary data to correctly get the right data from context). Possibly another stream going around, and then a join? I am not sure if mbus node always output messages if error occurs, so could easily lead to dangling unjoined messages or worse, messages joined incorrectly.

If you find a node that does not pass through the full message then you should raise an issue on the node's github page. There may be good reasons for a particular node not doing this, but generally they should pass the full message.

As for a workaround then yes, pass around and join is generally the best way. If necessary catching errors to make sure every input is matched with an output.

I think, nested somewhere in the modbus nodes is an option to keep msg properties (can't check as I'm afk)

This time it is mbus but I often mix those myself.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.