Deploying your flow
Once you have built your flow, you'll need to deploy it. As part of the deployment process you'll need to choose which mode to use and the subscription path for your flow to listen on.
There are two mode options for flow deployment:
Test mode is used for testing and debugging flows prior to deploying to Live mode.
Flows that are deployed in Test mode may only have one subscription and only one instance of the flow can be invoked at any time. In the event that multiple attempts are made to invoke a Test flow at the same time, only the first attempt will succeed, and a “Flow Locked” event will be written to the System Event Logs.
While in Test mode, the flow may be freely edited and the output of any debug nodes, or logging commands will be displayed in the debug sidebar tab. You may also make use of the Send Test Message, and Replay Last Message options within the flow editor.
If you change a flow from Live mode to Test mode, the existing subscriptions will be removed, and you’ll need to select a new one. If there is already a flow deployed in Test mode, the Test mode subscription will be inherited, and the existing Test flow will be undeployed.
Live mode is used once testing and debugging is complete.
Flows that are deployed in Live mode may have multiple instances invoked at the same time and benefit from the full Enterprise scalability of the Thingstream platform.
While in Live mode, the flow cannot be edited and the output of any debug nodes, or logging commands is supressed. You may however, freely amend the subscriptions.
If you change a flow from Test mode to Live mode, the existing subscription will be preserved, unless there is already a flow deployed in Live mode, in which case, the Live mode subscription(s) will be inherited and the existing Live flow will be undeployed.
Before you can deploy a flow, you will need to chose the MQTT topic(s) that the flow is subscribed to. This should match the topic that is being published to by your Thing(s).
When you click on edit in the subscription box of the deployment wizard, you'll be presented with a list of the topics that have been defined for your domain. You can pick one of these or enter a subscription path manually.
All Thingstream SN Things have a pre-defined "self" alias which can be used to publish and subscribe to messages. If your Thing uses this "self" alias, you can simply pick the entry for that Thing from the list and the flow will be subscribed to the path "device/<identity>/publish". You can also select "All devices" which will subscribe the flow to the "self" alias using a wildcard i.e. "device/+/publish" which will allow the flow to run for any <identity> value. Be careful though, subscribing to a Thing does not mean that you will see all messages published by that Thing, only messages published to the "self"alias topic will be seen by the flow.
Undeploying a flow
If you no longer want your flow to run, you can undeploy it by setting it to draft mode. In draft mode, all subscriptions are removed and the flow is editable.