Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editorial updates in Flow Designer docs #2867

Merged
merged 1 commit into from
Mar 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified en_US/flow-designer/assets/drag_node.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 26 additions & 13 deletions en_US/flow-designer/introduction.md
Original file line number Diff line number Diff line change
@@ -8,17 +8,17 @@ Flow Designer is an EMQX Enterprise feature.

The Flow Designer is a powerful visual tool that extends the capabilities of the earlier visual tool, Flows, by adding the ability to create and edit data processing workflows (Flows). This enhancement simplifies and streamlines the configuration of data processing and integration. Starting from EMQX v5.8.0, you can also test the data processing workflows you create.

Rules created on the Rule page and rules created in Flows are interoperable. This means you can create a rule in Flows and view its SQL and related configurations on the Rule page, or create the rule in the SQL Editor on the Rule page and then view the rule’s data flow processing configurations in Flows.
Rules created in the Data Integration and Flow Designer are interoperable. This means you can create a rule in Flow Designer and view its SQL and related configurations in the Data Integration, or create the rule in the SQL Editor in the Data Integration and then view the rule’s data flow processing configurations in the Flow Designer.

![flow-designer](./assets/flow-designer.png)

## Main Features

To access the Flows page in the EMQX Dashboard, click **Integrations** -> **Flow Designer** on the left menu. If you have already created rules or data integrations, you will see a directed acyclic graph composed of multiple nodes. Each node represents a data processing step, such as reading data from a topic, event, or Source, transforming data through rules, and forwarding data using actions or Sinks.
To access the Flows page in the EMQX Dashboard, click **Integrations** -> **Flow Designer** on the left menu. If you have already created rules or data integrations, you will see a directed acyclic graph composed of multiple nodes. Each node represents a data processing step, such as reading data from a topic, event, or [Source](../data-integration/data-bridges.md#source), transforming data through rules, and forwarding data using actions or [Sinks](../data-integration/data-bridges.md#source).

The Flows page displays all data processing workflows created using the Rules, Webhook, and Flow Designer. Through Flows, you can visualize how data flows—from devices or clients through rule processing to external data systems, or vice versa, from external data systems through rule processing back to devices. Refreshing the page updates it with the latest changes in rules and data integrations.

Clicking the **Create** button allows you to enter the Flow creation page for visual configuration. You can drag and drop to select the nodes needed for each step and connect them to implement the workflow.
Clicking the **Create Flow** button allows you to enter the Flow creation page for visual configuration. You can drag and drop to select the nodes needed for each step and connect them to implement the workflow.

![drag_node](./assets/drag_node.png)

@@ -28,7 +28,7 @@ The data input supports messages, events, or messages flowing from external data

- **Messages:** Specified through topics and topic wildcards for client-published messages.
- **Event:** Supports all client events within EMQX; refer to [Client Events](../data-integration/rule-sql-events-and-fields.md#mqtt-events).
- External Data Systems:
- **External Data Systems**:
- [MQTT Service](../data-integration/data-bridge-mqtt.md)
- [Kafka Consumer](../data-integration/data-bridge-kafka.md)
- [GCP PubSub Consumer](../data-integration/data-bridge-gcp-pubsub.md)
@@ -55,7 +55,7 @@ Outputs the data sources and processing results to specific nodes and external d

When a Flow is created, the system will randomly generate an ID for it. Click the edit icon next to the ID to modify the Flow's name and description.

To delete a node in the Flow, hover over the node and click the delete icon in the upper right corner of the node. Click on a node to enter the editing mode, you can modify its configuration details and save the changes, then, click **Save** to save the entire Flow. Click the **Start Testing** button to input simulated data or test the Flow with a real client to verify if it executes correctly.
To delete a node in the Flow, hover over the node and click the delete icon in the upper right corner of the node. Click on a node to enter the editing mode, you can modify its configuration details and save the changes, then, click **Save** to save the entire Flow. Click the **Start Test** button to input simulated data or test the Flow with a real client to verify if it executes correctly.

## Advantages

@@ -120,7 +120,7 @@ Sample data to be republished:

![filter_rule](./assets/filter_rule.png)

5. Select a **Republication** node from **Sink** and configure the topic for forwarding messages, setting it to `alert`. Format the processed and transformed data into an alert message with the following payload:
5. Select a **Republish** node from **Sink** and configure the topic for forwarding messages, setting it to `alert`. Format the processed and transformed data into an alert message with the following payload:

```bash
${device_id} device reported a high temperature of ${temperature}°C at ${date}.
@@ -140,26 +140,39 @@ Sample data to be republished:

### Test the Flow

1. After creating the Flow, click **Start Test** next to the **Save** button to open a bottom pop-up.
1. In the Flow Designer, click any node of the Flow to open an editting panel. Click the **Edit Flow** button at the end of the panel.

2. Click **Start Test** next to the **Save** button to open a bottom pop-up.

You can click **Input Simulated Data** to enter simulated data in the pop-up panel or use a real client to publish messages to see the results. This demonstration will use [MQTTX](https://mqttx.app) to publish real data.

![start_test](./assets/start_test.png)

2. Click **Input Simulated Data**. You can enter simulated data in the pop-up page or use a real client to publish messages to see the results. This demonstration will use [MQTTX](https://mqttx.app) to publish real data.
3. Open the [MQTTX Web](https://mqttx.app/web-client#/recent_connections). Click the **New Connection** to create a client connection as a publisher. Configure the following fields:

- **Name**: Enter `device1`.
- **Host**: Enter the connection address your EMQX server.
- **Port**: Enter `8084`.
- **Username** and **Password**: Enter the authentication information configured in the **Access Control** -> **Authentication** page.

Leave other settings as default and click **Connect**.

4. Create a new subscription. Set the topic as `alert`.

3. First, send a message with a temperature below 40°C. You will see that the message does not meet the condition and the rule SQL does not execute.
5. Publish a message with a temperature below 40°C. You will see that the message does not meet the condition and the rule SQL does not execute.

![message_publish_1](./assets/message_publish_1.png)

4. Next, publish a message with a temperature above 40°C. You will see the `alert` topic receiving the alert message.
6. Publish a message with a temperature above 40°C. You will see the `alert` topic receiving the alert message.

![message_publish_2](./assets/message_publish_2.png)

5. Return to the testing page to view the successful test results.
7. Return to the testing page to view the successful test results.

![test_success](./assets/test_success.png)

If the test results are unsuccessful, error messages will be displayed accordingly.

![test_fail](./assets/test_fail.png)


Binary file modified zh_CN/flow-designer/assets/image-20230914175657995.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 28 additions & 17 deletions zh_CN/flow-designer/introduction.md
Original file line number Diff line number Diff line change
@@ -6,25 +6,25 @@ Flow 设计器是 EMQX 企业版功能。

:::

Flow 设计器是强大的可视化工具,在早期版本的可视化查看工具 Flows 的基础上增加了创建和编辑数据处理流程 (Flow) 的能力,使数据处理和集成的配置变得更加简单和高效。从 EMQX v5.8.0 开始,您还可以对创建的数据处理流程进行测试。
Flow 设计器是一个强大的可视化工具,在早期版本的可视化查看工具 Flows 的基础上增加了创建和编辑数据处理流程 (Flow) 的能力,使数据处理和集成的配置变得更加简单和高效。从 EMQX v5.8.0 开始,您还可以对创建的数据处理流程进行测试。

在 Flow 中创建的规则和表单规则是互通的,也就是说可以使用 Flow 创建一个规则,在规则页面里查看规则 SQL 和相关配置,也可以在表单 SQL 编辑器里实现规则,然后在 Flow 中查看到规则的数据流处理相关配置
在 Flow 设计器中创建的规则和在数据集成中创建的表单规则是互通的。这意味着,您可以在 Flow 设计器中创建规则,并在数据集成页面查看对应的规则 SQL 及相关配置;或者,您也可以在数据集成的 SQL 编辑器中创建规则,然后在 Flow 设计器中查看规则的数据流处理配置

![EMQX Flow Designer](./assets/flow-designer.png)

## 主要功能

在 EMQX Dashboard 左侧菜单中点击**集成** -> **Flow 设计器**可以进入 Flows 页面。如果您已经创建了规则或数据集成,您可以看到由多个节点组成的有向无环图,每个节点代表一个数据处理步骤。
在 EMQX Dashboard 左侧菜单中点击**集成** -> **Flow 设计器**可以进入 Flows 页面。如果您已经创建了规则或数据集成,您可以看到由多个节点组成的有向无环图,每个节点代表一个数据处理步骤,例如从某个主题,事件或 [Source](../data-integration/data-bridges.md#source) 中读取数据、通过规则转换数据,再使用动作或 [Sink](../data-integration/data-bridges.md#source) 转发数据等

Flows 页面展示了通过规则引擎、Webhook 以及 Flow 设计器创建的所有数据处理流程。创建好的 Flow 能够直观得描述客户端消息与事件的处理流程,包括数据来源、数据处理与过滤、数据流出三个流程,例如从某个主题,事件或 Source 中读取数据、通过规则转换数据,再使用动作或 Sink 转发数据等。通过 Flows,您可以清晰地看到数据流向,即数据如何从设备或客户端经过规则处理后流向外部数据系统的数据流向,或者从外部数据系统经过规则处理后流向设备的数据流向。当有规则和数据集成发生变化时,刷新该页面就能看到最新的状态。
Flows 页面展示了通过规则引擎、Webhook 以及 Flow 设计器创建的所有数据处理流程。您可以直观地查看数据流向,即数据如何从设备或客户端经过规则处理后流向外部数据系统,或者从外部数据系统经过规则处理后流向设备。当有规则和数据集成发生变化时,刷新该页面就能看到最新的状态。

点击右上角的**创建**按钮,可进入 Flow 创建页面进行可视化配置。通过拖拽的方式选择每个步骤所需的节点,并将节点连线即可实现流程处理。
点击右上角的**创建 Flow** 按钮,可进入 Flow 创建页面进行可视化配置。通过拖拽的方式选择每个步骤所需的节点,并将节点连线即可实现流程处理。

![image-20230914175657995](./assets/image-20230914175657995.png)

### Source

数据的输入,支持消息、事件,或者外部数据系统流入的消息。Flow 中至少包含一个 Source 节点,同一个 Flow 中可以同时支持多个数据输入节点,目前支持的 Source 如下
数据的输入,支持消息、事件,或者外部数据系统流入的消息。Flow 中至少包含一个 Source 节点,同一个 Flow 中可以同时支持多个数据输入节点,目前支持的 Source 包括

- **消息**:通过主题与主题通配符指定客户端发布的消息来源。
- **事件**:支持 EMQX 内的所有客户端事件,参考[客户端事件](../data-integration/rule-sql-events-and-fields.md#客户端事件)。
@@ -45,7 +45,7 @@ Flows 页面展示了通过规则引擎、Webhook 以及 Flow 设计器创建的

### Sink

将数据来源以及处理结果输出到特定节点和外部数据系统中。同一个 Flow 中至少包含一个 Sink 节点,支持的 Sink 节点如下
将数据来源以及处理结果输出到特定节点和外部数据系统中。同一个 Flow 中至少包含一个 Sink 节点,支持的 Sink 节点包括

- **消息重发布**:将消息发布到本地指定的 MQTT 主题中。
- **控制台输出**:将消息打印到日志中,用于调试输出。
@@ -55,7 +55,7 @@ Flows 页面展示了通过规则引擎、Webhook 以及 Flow 设计器创建的

Flow 创建时系统将随机产生一个编号,点击编号旁边的编辑图标可以修改 Flow 的名称和描述。

将鼠标移动到 Flow 中的节点上,点击节点右上角的叉便可以删除该节点。点击节点可以进入编辑模式,您可以修改此节点中配置的信息并保存修改,最后点击**保存**以保存整个 Flow。点击**开始测试**按钮可以输入模拟数据或通过真实客户端测试 Flow 是否能正确执行。
将鼠标移动到 Flow 中的节点上,点击节点右上角的删除图标便可以删除该节点。点击节点可以进入编辑模式,您可以修改此节点中配置的信息并保存修改,最后点击**保存**以保存整个 Flow。点击**开始测试**按钮可以输入模拟数据或通过真实客户端测试 Flow 是否能正确执行。

## 特性与优势

@@ -98,15 +98,15 @@ Flow 设计器是一个功能丰富且易于使用的工具,有助于用户更

1. 点击 Flows 页面上的**创建 Flow** 按钮。

2. 从数据输入(**Source** 中拖动一个**消息**节点到画布上,并配置一个消息源主题,例如 `sensor/temperature`,然后点击**保存**。这一步通过主题指定客户端发布的消息来源。
2. **Source** 中拖动一个**消息**节点到画布上,并配置一个消息源主题,例如 `sensor/temperature`,然后点击**保存**。这一步通过主题指定客户端发布的消息来源。

![messages_node](./assets/messages_node.png)

3. 从数据处理 (**Processing** 中拖动一个`数据处理`节点到画布上,并配置数据处理规则,从消息中提取以下字段:
3. **Processing** 中拖动一个**数据处理**节点到画布上,并配置数据处理规则,从消息中提取以下字段:

- `payload.device_id`:设置别名为 `device_id`。
- `payload.temperature`:设置别名为 `temperature`。
- `timestamp`:使用 `format_date` 函数将发布过来的消息时间戳数值转换为可读的日期时间格式。设置别名为 `date`。
- `timestamp`:使用`时间与日期函数`中的 `format_date` 函数将发布过来的消息时间戳数值转换为可读的日期时间格式。设置别名为 `date`。
- `Time Unit`:选择 `milisecond`。
- `Time Offset`:输入 `+08:00`。
- `Data Format`:输入 `%Y-%m-%d %H:%M:%S.%6N%z`。参考[日期与时间转换函数](../data-integration/rule-sql-builtin-functions.md#format-date-unit-string-offset-string-integer-formatstring-string-time-integer-string)。
@@ -120,7 +120,7 @@ Flow 设计器是一个功能丰富且易于使用的工具,有助于用户更

![filter_rule](./assets/filter_rule.png)

5. 从数据输出(**Sink**中选择一个**消息重发布**节点,并配置转发消息的主题,这里设置为 `alert`。通过设置以下 payload 将处理和转换后的数据整理为一条告警信息:
5. **Sink** 中选择一个**消息重发布**节点,并配置转发消息的主题,这里设置为 `alert`。通过设置以下 payload 将处理和转换后的数据整理为一条告警信息:

```bash
${device_id} device reported a high temperature of ${temperature}°C at ${date}.
@@ -140,21 +140,32 @@ Flow 设计器是一个功能丰富且易于使用的工具,有助于用户更

### 测试 Flow

1. 创建完成后,点击**保存**按钮旁的**开始测试**,将出现一个底部弹出框。
1. 在 Flow 设计器中,点击任意节点会打开编辑面板,点击面板底部的**编辑** 按钮。

2. 创建完成后,点击**保存**按钮旁的**开始测试**,将出现一个底部测试面板。您可以点击**输入模拟数据**,在弹出的页面中输入模拟数据,也可以直接使用一个真实的客户端发布消息来查看结果。该演示将使用 [MQTTX](https://mqttx.app/zh),发布一条真实数据。

![start_test](./assets/start_test.png)

2. 点击**输入模拟数据**。您可以在弹出的页面中输入模拟数据,也可以直接使用一个真实的客户端发布消息来查看结果。该演示将使用 [MQTTX](https://mqttx.app/zh),发布一条真实数据。
3. 打开 [MQTTX Web](https://mqttx.app/web-client#/recent_connections),点击**新建连接**创建一个客户端连接作为发布者,并配置以下字段:

- **名称**:输入 `device1`。
- **服务器地址**:输入您的 EMQX 服务器连接地址。
- **端口**:输入 `8084`。
- **用户名**和**密码**:输入您在**客户端认证**中配置的认证信息。

其余设置保持默认,点击**连接**。

4. 创建一个新的订阅,并将主题设置为 `alert`。

3. 先发送一个低于 40 度的消息。可以看到消息没有达到条件,规则 SQL 没有执行结果。
5. 发送一个低于 40 度的消息。可以看到消息没有达到条件,规则 SQL 没有执行结果。

![message_publish_1](./assets/message_publish_1.png)

4. 再发布一条温度大于 40 度的消息。可以看到 `alert` 主题接收到了告警信息。
6. 发布一条温度大于 40 度的消息。可以看到 `alert` 主题接收到了告警信息。

![message_publish_2](./assets/message_publish_2.png)

5. 回到测试页面,同样可以查看到测试结果成功。
7. 回到测试页面,同样可以查看到测试结果成功。

![test_success](./assets/test_success.png)