I have to connect my software to four (or more - in the future) MQTT-Servers a once. All MQTT-Servers are of the same kind. My idea is to create a subflow which contains the [mqtt-in]- and [mqtt-out]-nodes. The subflow has a "serverNr" property. At the subflow input only messagens with correct serverNr are forwarded to the [mqtt-out]-node. At the subflow output all messages from the [mqtt-in]-node are marked with the serverNr.
My Question is: How do I set different MQTT-configuration nodes for instances of the subflow? I figured out, that it is possible to set a configuration node as subflow-property but I don't unterstand how to use this property in the server property of the [mqtt-in]- and [mqtt-out]-nodes.
Can you explain what you mean by MQTT-Servers, and why four of them?
MQTT has a broker rather than a server, and it would be an unusual situation where you need to publish or subscribe to topics on more than one broker.
The mqtt nodes allow dynamic connect/disconnect, so the subflow can connect to the relevant broker based on your "serverNR" property (do you mean msg.serverNR? )
After you add the config env var in the subflow template, when you edit an MQTT in/out inside the subflow template, the dropdown will have an [env] xxxx entry.
Personally, i just avoid this whole pattern and generate the required brokers so I can drop MQTT nodes wherever I please on the flows without the worry of instantiating multiples or feeding every message to a subflow instance (it just gets too messy for my liking)
Hello jbudd,
I far as I understand the regular term is "MQTT broker", NodeRED uses Server instead. This is a NodeRED Forum, so I used the NodeRED convention.
I want to connect to four of them because I used four propertarian systems, each of them is equipped with an own MQTT Server. I want to build a central status display. I think there is no was to persuade the manufactor to publish on an MQTT server of my choice.
"Broker" is the more functional description of an "MQTT Server", while "Server" is the more technical wording for a system wainting clients to connect to a provided service - here "MQTT Brokerage". Some sort of "Matter of Taste".