How To Dev - Thumb Rules on Snap4City Processing Logic development


Warning message

You can't delete this newsletter because it has not been sent to all its subscribers.


  1. Take in mind that using asynchronous stateless rest calls is the best modality to work with MicroServices.
  2. Each Rest Call of the Snap4City Environment and thus each Node in Node-RED should be stateless on the dialogue among systems and subsystems.
  3. Each Node in node-RED Proc.Logic:
    • Receive messages from the single INPUT on the “msg”.
    • Send a number of messages from its outputs which can be 1 or more according to the Node design. The Function node may provide multiple Output according to the setting performed on visual programming/configuration of the specific node.
    • All the messages msg are JSON formatted, and may contain other data kind in ASCII code, such as HTML, XML, CSV, encoding, etc.
    • The msg (In/OUT) can have substructures such as msg.payload, msg.topic, and the developer can add other custom.
  4. You may have temporary data storage into the processing logic at level of context, flow or processing logic global for data exchange among tabs by using constructs as follows. These constructs should be used carefully since the data are not saved if your Processing Logic is restarted as happen periodically on cloud. MyKPI and Entities can be used for safe status changes and long terms storage. So that be careful in using.
    • context means into the subflow
      • Var nax, nax2;
      • context.set("name",nax); // to temporary store a variable
      • nax2 = context.get("name"); //to retrieve a variable 
    • flow means into the Folder Flow
      • Var nax, nax2;
      • flow.set("name",nax); // to temporary store a variable
      • nax2 = flow.get("name"); //to retrieve a variable 
    • global means into the Folder Flow
      • Var nax, nax2;
      • global.set("name",nax); // to temporary store a variable
      • nax2 = global.get("name"); //to retrieve a variable 
  5. Each Entity (virtual of physical) may have a status saved on Storage (via Orion Broker node V2), and the status can be used to align subsystems to the evolution of the dialog among entities, allowing to keep trace of the versioning and time evolution, aka time series.
  6. improve your Processing Logic (IoT App) which are Node-RED flows by adding nodes needed, taking in mind that you can:
    • test them step by step on deploy,
    • save/load and share the flows in JSON files,
    • collaborate on editing with other colleagues sharing the same account,
    • load in your Processing Logic (IoT App) any kind of examples from public Node-RED library from JS foundation, via menu and Import function,
    • Install in your Processing Logic (IoT App) any kind of Node-RED library from JS foundation, via menu and Managing Pallet,
    • create your own microservice/node for API using the Snap4City tools,
    • etc.