From ff8f1223035a371d294fd74e93013cba2ad1acbd Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Thu, 10 Jan 2019 12:58:10 +0000 Subject: [PATCH] Created Design: Dynamic MQTT node (markdown) --- Design:-Dynamic-MQTT-node.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Design:-Dynamic-MQTT-node.md diff --git a/Design:-Dynamic-MQTT-node.md b/Design:-Dynamic-MQTT-node.md new file mode 100644 index 0000000..fa93e28 --- /dev/null +++ b/Design:-Dynamic-MQTT-node.md @@ -0,0 +1,29 @@ +There is a requirement for the MQTT nodes to allow for more dynamic configuration. There are two uses: + + - determine a subscription topic at runtime + - modify broker connection details at runtime + +This design note proposes a new MQTT node that can be used to satisfy these requirements. + +--- + +Here's the basic outline: + + - A new MQTT node is proposed called `mqtt-control` (name, as ever, subject to change). + - The node has an input and an output so sits in the middle of a flow + - The node is configured with an `mqtt-broker` node - this broker node provides the connection used by the control node. + - The node can be passed messages with a well-defined property (eg `msg.mqttControl`) that causes it to take an action. + - The actions the node can take are: + - Connect to its broker (with any of the `mqtt-broker` node's properties overridden by properties in the message) + - Disconnect from the broker + - Subscribe to a topic + - Unsubscribe from a topic + - Publish a message to a topic + - The node will send any message it receives due to its subscriptions. + - It will also pass through messages it receives when the action is complete. **TODO**: identify how to distinguish these from subscription messages + + +Some observations from this design: + + - the control node is controlling the `mqtt-broker` node. Other regular nodes can also use that `mqtt-broker` node so will also be effected by changes. + - the `mqtt-broker` config node will have a new option to not auto-connect. This would be used where the decision to connect is left to the application's use of the control node.