Flow Design Principles

caution

The order of your flows is important! Make sure nodes are always placed in the correct order to ensure desired functionality.

Messages

Flows are only active when a message is passed through them. The functionality of each node is triggered when the message passing through a flow arrives at the node. Messages start at the beginning of a flow (at the point of injection) and terminate at the end of the flow. As such, the order of nodes in a flow is important!

Message injection

To activate a flow, a message must be passed through it. Therefore, a key design principle of flows is that the first node in a flow must inject a message periodically into the flow. Nodes that can inject messages into a flow by are the inject node or sensor nodes . An inject node injects a user configured message—by default a unix timestamp—into a flow and can be set to do the injection repeatedly at certain intervals. Sensor nodes inject a data message by an event-driven approach—whenever new data is available—into a flow.

Editing Messages

As messages pass through a flow, each node is activated when it receives that message and may—or may not—edit or add information to the message. Precisely how a node modifies a message depends on the node itself. In most cases, a node will receive a message, be triggered into performing some functionality, then add information to the flow’s message.

Flow Order

As messages move in one direction through a flow and generally nodes enrich information along the way, the order of nodes can be important. If later nodes are reliant on specific aspects of a flow’s message which are added by an earlier node then make sure the order of your flow is correct.

Example of why flow order is important

The create order node, communicates with external cryptocurrency exchanges. It places buy or sell orders on these exchanges when it receives the flow’s message. A user can either tell the create order node exactly what to buy or sell, or a user can tell the node to take action based on the information within the incoming flow message.

The dca node does not communicate with any external cryptocurrency exchanges. It does however perform investment logic internally and adds information to the flow’s message about which coins should be bought or sold.

Therefore, if a user wishes to create a flow with the dca node, the dca node should come before the create order node in the flow order. This ensures that when the flow’s message arrives at the create order node, it already contains all the information from the dca node, about which coins to buy or sell.

Last updated on Sep 15, 2022

Newsletter

Subscribe to our newsletter to stay updated and to get notified once the platform officially launches:

By subscribing, you agree with Foretale’s Privacy Policy

© foretale - 2022