Dynamic MQTT brokers in subflow

I am trying to build a subflow which has an MQTT In node in it, where the broker url is configured via subflow properties. I thought I would be able to achieve this by using Dynamic mode in the MQTT node, and set the broker url via an Inject node that fires on startup.
I now realise that, unfortunately, setting the broker url does not set the url to be used by the MQTT In node, but it sets the url to be used by the broker that the node is configured to use. The result is that, since all the subflow instances use the same broker config node, they all change url when one of them changes, so the subflow instances cannot use different brokers.

Is there a way to achieve what I want? I could pre-configure multiple broker nodes with the appropriate details, but I can't see a way to use an environment variable to determine which broker node to use.

Have you tried scoping the mqtt broker node to the subflow, rather than the default of it being a global config node? (You do this via the drop-down select box at the bottom of the config node's edit dialog)

I think that will mean each instance gets its own copy of the config, rather than sharing an instance.

Magnificent! I had completely forgotten about that feature, and even if I had remembered I did not realise the significance with respect to subflows.
It appears to be working perfectly, at first quick test anyway.


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