I want a MQTT subscription client to consume messages from AWS IoT broker. On AWS IoT broker, wild card topic subscription is not supported. In our use case, we know the upper bound of number of possible subscriptions. We also know, when a device is set-up to deliver publications. Finally, the processing for every subscription is exactly the same. I have a message flow that is well tested for processing the data published from one device.

  1. Is there a programmatic way to deploy that flow as a new flow with only the MQTT Input node configured for a specific topic string?
  2. Conversely, is there a way to "un-deploy" a particular copy of flow for a particular topic string in cases where device maybe decommissioned?
up vote 4 down vote accepted

You need to look at the Node-RED Admin API, this will allow you to retrieve the current flow, you can then manipulate it and push an updated version back to the runtime.

Flows are represented as JSON objects that have entries for each node on the canvas and the links between them.

The best place to get help with the API will be on the Node-RED forum or Slack team. Both are linked to from the Node-RED homepage.

  • Ok, use GET API to download flow. Manipulate the JSON to create a new array entry for the 'to be deployed' flow. Then, POST API to deploy this updated version. Is this correct? – cogitoergosum Sep 11 at 6:25
  • 1
    yep, pretty much. – hardillb Sep 11 at 6:26

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.