Integration flows

更新时间:
复制 MD 格式

The Mobi platform includes a powerful feature for orchestrating integration flows. Using simple configurations, you can quickly build a flow to perform complex operations. This topic describes how to use the integration flow feature.

What is an integration flow?

An integration flow combines multiple integration actions in a specific order to implement complex logic. Mobi provides a rich set of integration flow nodes, such as custom code, Large Language Models (LLMs), resource connections, and conditional logic. You can combine and orchestrate these nodes to quickly build an integration flow that meets your requirements.

Integration flow designer interface

The Integration Flow Designer interface:

Label

Feature name

Instructions

1

Mobi logo and integration flow name

Click the logo to return to the integration flow list.

2

Version history

Publish or roll back committed versions.

3

Feature panel on the left

Integration flow feature options.

4

Error check

Shows the number of errors and warnings. Click to open the error message panel.

5

Integration flow canvas workspace

The workspace where you orchestrate the integration flow.

7

Simulation test panel

Test integration nodes and the flow.

8

Commit and publish

Commit and publish the integration flow.

Integration flow nodes

Node types

Trigger node

The trigger node is the starting node of a flow. It contains the global configuration for the flow, including parameters, timeout settings, and policies. The trigger node is a value-carrying node. You can reference the user-configured parameters with trigger.data.

Note

A value-carrying node is a type of node that contains data after initialization or execution. You can access its data using the format {node_id.data}. Trigger nodes, integration action nodes, and variable nodes are all value-carrying nodes.

Parameter descriptions:

Name

Description

Type

Required parameters

Defines the parameters that must be set when the integration flow is called.

Optional parameters

Defines the parameters that can be optionally set when the integration flow is called.

Timeout

If the integration flow runs longer than the set time, a timeout error is returned.

Number, in milliseconds

Integration action node

Integration action nodes have multiple action types, such as script, SQL, and Model Studio applications.

Script

You can write logic scripts using JavaScript. The script is encapsulated as an asynchronous function and executed in the background. The script that you enter becomes the function body. The value returned by the function becomes the value of the node object's data property. The structure is similar to the following:

async () => {
  // your code here
}

The following table describes the configuration items.

Name

Description

Type

Code

The code serves as the body of an asynchronous function.

JavaScript

Other types
Note

Integration nodes are value-carrying nodes. You can reference their data using {node_id.data}.

if node

The if node works like an if...else statement in a programming language, as shown in the following example:

if (condition) {
  // statement 1
} else {
  // statement 2
}

An if node consists of the following three parts:

  • Condition [Required]: A JavaScript expression that evaluates to a Boolean value.

  • if node collection [Required]: The collection can contain any nodes.

  • else node collection [Optional]: The collection can contain any nodes.

Name

Description

Type

Condition

The condition to evaluate. It must return true or false.

JavaScript expression

Note

A node must have a value to be referenced.

while node

The while node works like a while loop in a programming language, as shown in the following example:

while (condition) {
  // statement
}

A while node consists of the following two parts:

  • Condition [Required]: A JavaScript expression that evaluates to a Boolean value.

  • Node collection [Required]: The collection can contain any nodes.

Note

The while node is not a value-carrying node and cannot be referenced.

try node

The try node works like a try...catch statement in a programming language, as shown in the following example:

try {
  // tryStatements
} catch (exception) {
  // catchStatements
} finally {
  // finallyStatements
}

A try node consists of the following three parts:

  • try node collection [Required].

  • catch node collection [Optional]: Nodes within the catch collection can access the caught exception using the error keyword. The error object contains code and message properties.

  • finally node collection [Optional].

Note

The try node is not a value-carrying node and cannot be referenced.

throw node

The throw node works like a throw statement in a programming language, as shown in the following example:

throw expression;

It is usually defined within a try node collection. The thrown error is handled in the catch node collection.

The following table describes the configuration items.

Name

Description

Type

Exception code

The exception code.

String

Exception message

The exception message.

JavaScript expression

Note

The throw node is not a value-carrying node and cannot be referenced.

Variable node

The variable node works like let in JavaScript. It declares a block-scoped local variable that can be reassigned, and you can optionally initialize it to a value.

You can assign values in two ways within an integration flow:

  • Explicit assignment: Use an assignment node to assign a value.

  • Implicit assignment: Set the value of the node object's data property in a script or expression. For example, variableId.data = xxx.

Name

Description

Type

Default value

The default value of the variable.

JavaScript expression

Note

The variable node is a value-carrying node. You can reference its data using {node_id.data}.

Assignment node

The assignment node explicitly assigns a value to a variable node.

An assignment node consists of two parts:

  • Assignment target: The variable to be assigned.

  • Value: A JavaScript expression.

Name

Description

Type

Default value

Default variable value

JavaScript expression

Note

The assignment node is not a value-carrying node and cannot be referenced.

User task node

The user task node lets you temporarily interrupt an integration flow and wait for user input. For more information, see User task nodes and interruptible integration flows.

Return node

The return node works like a return statement in a programming language. The value returned by the return node becomes the execution result of the entire integration flow.

Name

Description

Type

Value

The return value.

JavaScript expression

Node scope

When you write code, you often need to consider the effects of scope.

Scope is the current execution context where values and expressions are "visible" or accessible. If a variable or expression is not in the current scope, it is unavailable. Scopes can also be stacked in a hierarchy. A child scope can access its parent scope, but not the other way around.

A similar concept exists in integration flow orchestration. The concept of node scope is very similar to variable scope in programming. In an integration flow, scope determines whether a node object can be accessed or referenced.

There are two types of node scopes:

  • Global scope: The scope that contains nodes at the same level as the trigger node.

  • Block scope: An inner scope created by collection-type nodes. External nodes cannot access the node objects of inner nodes. Collection-type nodes include if, while, and try nodes.

Note

Regarding block scope, consider the if node as an example. Nodes in the if node collection cannot access nodes in the else node collection, and vice versa. This is because the if and else collections each create an independent inner scope.

Build an integration flow

Create an integration flow

First, create an integration flow. In the console, choose Resources > Integration Flow, and then click Create Integration Flow.

Orchestrate an integration flow

Orchestrating an integration flow can include the following actions:

  • Creating a node.

  • Changing the node's identifier (ID) for better readability (optional).

  • Setting the node's configuration items.

  • Checking the error check panel for errors.

  • Cloning a node to make minor changes.

  • Deleting incorrectly created or configured nodes.

  • Testing a node (for integration nodes).

  • Adjusting the relationships between nodes.

You can perform the following actions on integration flow nodes:

  • Add a node: When you hover the mouse pointer over the edge between nodes, a button for adding a node appears. Click the button and select a node type. After a node is created, it is assigned a default node ID. The ID is the unique identifier for the node and also serves as the node variable within its scope. You can modify the node ID to provide a more readable name, similar to defining a variable name. To modify the node ID, select the node and click the ID field to edit it. The ID must be unique.

  • Delete a node: Select the node and click Delete Node at the bottom of the configuration panel. Alternatively, you can click the More button on the node card and select Delete Node.

  • Clone a node: Click the More button on the node card and select Clone Node.

  • Move a node: You can drag and drop a node to the desired position. Changing the position also changes the node's relationships. For example, if you drag a node from an if node collection to an else node collection, the node is executed when the else logic is triggered.

After you add nodes, you must configure the necessary properties for each node. When you select a node, its configuration items appear in the configuration panel on the right side of the editor.

Test an integration flow

After you configure an integration node or finish orchestrating the entire flow, you must verify that it works as expected. The Mobi integration flow editor provides a test feature.

The tester in the trigger configuration panel simulates the execution of the entire flow. The tester in an integration node's configuration panel tests the current integration action.

调试面板.png

The preceding figure shows the test panel for the integration flow. It consists of the following main parts:

Simulation parameters

Simulation parameters display the node data that the script or configuration of an integration node (action node) depends on.

The simulation parameters are displayed as a JavaScript object. The object's properties are the IDs of the nodes referenced in the configuration items. The values are the node object values, which are null by default.

The following are three exceptions:

  • The trigger simulation data that is set in the trigger panel is globally available.

  • The referenced node is a variable node. Mobi reads the value from that variable node's configuration. If the variable expression has no external node references, the result can be obtained directly using `eval`.

  • If the referenced node is an integration node and already has a test result, that result is used as the default value.

You can add, edit, or delete simulation parameters. You can set the values as required. These values are used as parameters for testing the node.

Note

Note the following:

  • Keep the node object structure intact. The data property cannot be deleted.

  • To enter an object in the input box, wrap the content in parentheses. For example: ({key:val}).

Test results

The figure shows the test status indicator. Different colors represent different statuses. The three statuses are as follows:

  • Gray: The test is pending.

  • Green: The test is successful. The execution succeeded and a result was obtained.

  • Red: The test failed. The success identifier in the returned result is `false`. You can adjust the configuration or code based on the error message.

The content area displays the test result. The result remains displayed until you run another test or the simulation parameters change.

Test/Run

This button runs the flow or executes the integration action based on the configuration information and simulation parameters.

Commit and publish

Submit

After you commit an integration flow, a commit record is created. You can view the record in the History section of the feature panel on the left. You can publish or roll back records.

Publish

By default, the latest commit record is published. If the current workspace content has not been committed, selecting an environment and clicking Publish creates a commit and then publishes it. You can also choose to publish other records. A published integration flow can be used in the application designer.

Important

You can publish an integration flow to a development environment or a production environment. To use the integration flow action in the application editor, you must first publish the target integration flow to the development environment.

To ensure that the integration flow also works correctly in the production environment, make sure that the relevant integration flow is published to the production environment before you publish the application.

Error check

Similar to the page editor, the integration flow editor provides an error check feature to help you find problems promptly.

The error check for integration flows includes the following checks:

  • Node ID reference validity.

  • Checking JavaScript scripts and expressions for errors.

  • Required fields in the node configuration.

  • Validity of integrated resources that are referenced by the node.

Label

Feature name

Usage notes

1

Error search box

Search for errors in the flow.

2

Number of errors and warnings

Red indicates an error. Orange indicates a warning.

3

Error message

The error message.

4

Error path

The location of the node that caused the error. Click the path to select the node and display its configuration information.