Creating a Flow
Flows are distributed serverless applications. Visually orchestrate multiple independent serverless functions into an application in sequential, branch, or parallel mode using Low Code technology. In addition, diagnose and debug your applications through a monitoring and management platform.
This section describes how to create and orchestrate a flow. You can create a standard or express flow for your service requirements.
- Standard flow: better for common services that take a long time to execute. Standard flows can only be invoked asynchronously, and their execution records are persisted for query.
- Express flow: better for services that take less than 5 minutes to execute and require ultimate performance. Express flows can be invoked synchronously or asynchronously, but their execution records (such as execution node history) are not persisted. The synchronous execution interface returns results, and the execution logs reported to LTS are displayed on the logs page.
Express flows are available for free trial as a time-limited offer.
Notes and Constraints
Flows are available only in CN East-Shanghai1 and AP-Singapore.
Creating a Flow
Procedure
- Log in to the FunctionGraph console. In the navigation pane, choose Flows.
- Click Create next to Standard Flow or Express Flow.
- Orchestrate the flow by dragging components as in Configuring Function a Flow Component.
A flow must be a directed acyclic graph (DAG). It has a start node followed only by one node (except the error handling and stop nodes) and ends after another node. You can end a flow in the following ways:
- Do not connect any conditional, parallel, or start node to the last node of the flow.
- Add a stop node as the last node of the flow.
- After configuring all nodes, click Save in the upper right corner, set parameters, and click OK.
Table 1 Parameter description Parameter
Description
Name
Enter the name of the function flow.
Enterprise Project
Select an enterprise project.
Logs
Required when creating an express flow.
- ALL: All events will be recorded.
- ERROR: Only errors will be recorded.
- NONE: Log recording is disabled.
Combine Input
Whether to combine the previous node's output with the current node's input.
Streaming Response
Required when creating an express flow. If this option is enabled, the flow returns data in a stream. For details, see stream file processing.
The code of function nodes in the flow will call the streaming data API.
Description
Description about the flow.
Expression Description
The JSONPath expression used for Retry Condition (JSONPath) in the Error Handling component and for Input Filter Expression and Output Filter Expression in the Conditional Branch component follows the structure: [JSONPath] + [Logical operator] + [Comparison data], for example, $.age >= 20.
Operator |
Supported or Not |
Description |
---|---|---|
$ |
Yes |
The root element to query. This starts all regular expressions. |
@ |
Yes |
The current node being processed. |
. |
Yes |
Subnode. |
[ (, )] |
Yes |
Array indexes. |
[start:end] |
Yes |
Array slice operator. |
[?()] |
Yes |
Filter expression, which must be evaluated to a Boolean value. |
{ "fruits": [ "apple", "orange", "pear" ], "vegetables": [{ "veggieName": "potato", "veggieLike": true }, { "veggieName": "broccoli", "veggieLike": false }] }
- Simple value
The $.fruits expression obtains all values under fruits.
The result of $.fruits is ["apple","orange","pear"].
- Simple filtering
Expression: $.vegetables[?(@.veggieLike == true)].veggieName
Meaning: Obtains all values of the key vegetables and outputs the value of veggieName whose veggieLike is True.
Result: [potato]
Operators
The following data is used as input parameters in the examples:
{ "name" : "apple", "weight": 13.4, "type": [3,4,6,8], "obj": { "a" : 1 } }
Operator |
Description |
Example |
Return Value |
Remarks |
---|---|---|---|---|
== |
Equal to |
$.name == 'apple' |
true |
Supported data types: int, float, string, bool, and nil |
!= |
Not equal to |
$.name != 'apple' |
false |
Supported data types: int, float, string, bool, and nil |
< |
Less than |
$.weight < 12 |
false |
Only numbers supported |
> |
Greater than |
$.weight > 12 |
true |
Only numbers supported |
<= |
Less than or equal to |
$.weight <= 13.4 |
true |
Only numbers supported |
>= |
Greater than or equal to |
$.weight >= 13.4 |
true |
Only numbers supported |
'*' |
Wildcard |
$.weight == '*' |
true |
Must be used together with ==. |
|| |
Or |
$.name == 'apple' || $.weight < 12 |
true |
Used together with () for complex AND/OR logic. |
&& |
And |
$.name == 'apple' && $.weight < 12 |
false |
Used together with () for complex AND/OR logic. |
- A string constant must be enclosed with single quotation marks (''). For example, 'apple'.
- JSONPath expressions cannot contain =, !=, <, >, |, or &.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot