Skip to content

Commit

Permalink
feat(en_kafka): modify data integrations kafka en docs
Browse files Browse the repository at this point in the history
  • Loading branch information
zibuyu1995 committed Mar 11, 2022
1 parent 493b9c8 commit 8711d36
Show file tree
Hide file tree
Showing 35 changed files with 163 additions and 106 deletions.
4 changes: 2 additions & 2 deletions directory.json
Original file line number Diff line number Diff line change
Expand Up @@ -652,11 +652,11 @@
},
{
"title": "Rule Management",
"path": "rule_engine/rule"
"path": "rule_engine/rules"
},
{
"title": "Resource Management",
"path": "rule_engine/resource"
"path": "rule_engine/resources"
},
{
"title": "Rule engine events",
Expand Down
4 changes: 2 additions & 2 deletions en_US/deployments/rule_engine.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ In EMQX Cloud, using the rule engine has the following requirements and restrict
- The resource only supports intranet access, so you need to configure VPC peering before creating the resource and open the security group.


## [Rule Management](../rule_engine/rule.md)
## [Rule Management](../rule_engine/rules.md)

The rule engine not only provides a clear and flexible "configurable" business integration solution, simplifies the business development process, improves user usability, and reduces the coupling degree between the business system and EMQX, but also provides a superior infrastructure for EMQX's proprietary functionality customization.

## [Resource Management](../rule_engine/resource.md)
## [Resource Management](../rule_engine/resources.md)

EMQX Cloud resources are used for rule engine response actions, before which you need to ensure that the deployment status is running.

Expand Down
22 changes: 18 additions & 4 deletions en_US/release_notes.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,47 @@
# Version release

## 2022-3-19

* Replace Rule Engine with Data Integration

## 2022-1-19

* Support Intranet and NAT Gateway LB VAS

## 2021-11-19

* Support Subaccount Management

## 2021-09-19
## 2021-09-19

* Support Project Management

## 2021-08-19
## 2021-08-19

* Support Google Cloud Platform

## 2021-07-19

* Support Azure Cloud Platform

## 2021-06-19
* Optimization of User Interface Design

* Optimization of User Interface Design

## 2021-05-13

* New Pricing Plans

## 2021-03-15

* New UI design

## 2020-12-21

* Support the creation of 180-day free trial

## 2020-09-17

* Deployment a dedicated dashboard

## 2020-07-15
Expand All @@ -52,4 +66,4 @@

## 2019-09-30

* EMQX Cloud Service is released
* EMQX Cloud Service released
Binary file removed en_US/rule_engine/_assets/add_kafka_action02.png
Binary file not shown.
Binary file removed en_US/rule_engine/_assets/add_kafka_action03.png
Binary file not shown.
Binary file removed en_US/rule_engine/_assets/add_kafka_action04.png
Binary file not shown.
Binary file removed en_US/rule_engine/_assets/add_kafka_action05.png
Binary file not shown.
Binary file removed en_US/rule_engine/_assets/add_kafka_action06.png
Binary file not shown.
Binary file removed en_US/rule_engine/_assets/add_kafka_action07.png
Binary file not shown.
Binary file removed en_US/rule_engine/_assets/buy_aliyun_kafka01.png
Binary file not shown.
Binary file removed en_US/rule_engine/_assets/buy_aliyun_kafka02.png
Binary file not shown.
Binary file removed en_US/rule_engine/_assets/buy_huawei_kafka.png
Binary file not shown.
Binary file not shown.
Binary file modified en_US/rule_engine/_assets/kafka_action.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified en_US/rule_engine/_assets/kafka_create_resource.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added en_US/rule_engine/_assets/kafka_create_sql.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added en_US/rule_engine/_assets/kafka_monitor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified en_US/rule_engine/_assets/kafka_query_result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified en_US/rule_engine/_assets/mqttx_publish.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed en_US/rule_engine/_assets/set_huawei_kafka_port.png
Binary file not shown.
Binary file removed en_US/rule_engine/_assets/set_huawei_kafka_topic.png
Binary file not shown.
Binary file removed en_US/rule_engine/_assets/view_monitor_kafka.png
Diff not rendered.
Binary file removed en_US/rule_engine/_assets/view_rule_engine_kafka.png
Diff not rendered.
4 changes: 2 additions & 2 deletions en_US/rule_engine/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ In EMQX Cloud, using the rule engine has the following requirements:
- Professional Deployment
- The resource only supports intranet access, so you need to configure VPC peering before creating the resource and open the security group.

## [Rule Management](./rule.md)
## [Rule Management](./rules.md)

The rule engine not only provides a clear and flexible "configurable" business integration solution, simplifies the business development process, improves user usability, and reduces the coupling degree between the business system and EMQX, but also provides a superior infrastructure for EMQX's proprietary functionality customization.

## [Resource Management](./resource.md)
## [Resource Management](./resources.md)

EMQX Cloud resources are used for rule engine response actions, before which you need to ensure that the deployment status is running.

Expand Down
File renamed without changes.
142 changes: 83 additions & 59 deletions en_US/rule_engine/rule_engine_confluent.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,46 @@
# Bridge device data to Confluent Cloud using the Rule Engine
# Bridge device data to Confluent Cloud using the Data Integrations

In this article, we will simulate temperature and humidity data and report these data to EMQX Cloud via the MQTT protocol and then use the EMQX Cloud rules engine to dump the data into Confluent Cloud.
In this article, we will simulate temperature and humidity data and report these data to EMQX Cloud via the MQTT protocol and then use the EMQX Cloud Data Integrations to bridge the data into Confluent Cloud.

Before you start, you need to complete the following operations:

* Deployments have already been created on EMQX Cloud (EMQX Cluster).
* This feature is available for professional deployment
* There are three types of Confluent Cloud cluster you could choose:
* For basic and standard cluster, please open the NAT first.
* For dedicated cluster, please complete [Peering Connection Creation](../deployments/vpc_peering.md) first, all IPs mentioned below refer to the intranet IP of the resource.

* For basic and standard cluster, please open the NAT first.
* For dedicated cluster, please
complete [Peering Connection Creation](../deployments/vpc_peering.md) first, all IPs mentioned
below refer to the intranet IP of the resource.

<div style="position: relative; padding: 30% 45%;">
<iframe style="position: absolute; width: 100%; height: 100%; left: 0; top: 0;" src="https://www.youtube.com/embed/jLn0q8xf-1Y" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>


## Confluent Cloud Configuration

### Create a cluster

* Login to the Confluent Cloud console and create a cluster.
* At this time, we select the dedicated cluster as an example.
* Login to the Confluent Cloud console and create a cluster.
* At this time, we select the dedicated cluster as an example.

![cluster](./_assets/confluent_cluster.png)
![cluster](./_assets/confluent_cluster.png)

* Select region/zones (make sure the deployment region matches the region of the Confluent Cloud)
* Select region/zones (make sure the deployment region matches the region of the Confluent Cloud)

![region](./_assets/confluent_region.png)
![region](./_assets/confluent_region.png)

* Select VPC Peering for the networking so this cluster could be accessed only by vpc peering connection.
* Select VPC Peering for the networking so this cluster could be accessed only by vpc peering
connection.

![nat](./_assets/confluent_nat.png)
![nat](./_assets/confluent_nat.png)

* Specify a CIDR block for the cluster and click `Conttinue`
* Specify a CIDR block for the cluster and click `Conttinue`

* Based on your needs, choose the way to manage the encryption key
![security](./_assets/confluent_security.png)
* Based on your needs, choose the way to manage the encryption key

![security](./_assets/confluent_security.png)

* After binding the card, you are ready to launch the cluster
* After binding the card, you are ready to launch the cluster

### Manage the cluster using Confluent Cloud CLI

Expand Down Expand Up @@ -124,75 +126,97 @@ ccloud kafka topic consume -b topic-name

After the cluster has been created, we should add peering

* Go to the `Networking` section of the `Cluster settings` page and click on the `Add Peering` button.
* Go to the `Networking` section of the `Cluster settings` page and click on the `Add Peering`
button.

![addPeering](./_assets/confluent_addPeering.png)
![addPeering](./_assets/confluent_addPeering.png)

* Fill in the vpc information. (You could get the information from `VPC Peering` section of the deployment console)

![vpc_info](./_assets/confluent_vpc1.png)

![vpc_info](./_assets/confluent_vpc2.png)
* Fill in the vpc information. (You could get the information from `VPC Peering` section of the
deployment console)

* When the connection status is `Inactive`, go back to the deployment console to accept the peering request. Fill in the vpc information of the confluent cloud cluster and click `Confirm`. When the vpc status turns to `running`, you successfully create the vpc peering connection.
![vpc_info](./_assets/confluent_vpc1.png)

![vpc_info](./_assets/confluent_vpc2.png)

![vpc](./_assets/confluent_finish.png)

![vpc_info](./_assets/confluent_vpc2.png)

## EMQX Cloud rule engine configuration
* When the connection status is `Inactive`, go back to the deployment console to accept the peering request. Fill in the vpc information of the confluent cloud cluster and click `Confirm`. When the vpc status turns to `running`, you successfully create the vpc peering connection.

Go to the `Rule Engine` page
![vpc_info](./_assets/confluent_vpc2.png)

1. Create a new resource
![vpc](./_assets/confluent_finish.png)

Click on the `+ New` button in the `Resources` section and select `Kafka` as the resource type. Fill in the Conflent Cloud information you have just created and click Test. If you get an error, instantly check that the database configuration is correct.
![create resource](./_assets/confluent_create_resource.png)

2. Create a new rule

Click on the `+ New` button in the `Rules` section. Enter the following rule to match the SQL statement. In the following rule we read the time `up_timestamp` when the message is reported, the client ID, the message body (Payload) from the `temp_hum/emqx` topic and the temperature and humidity from the message body respectively.
## Deployment Data Integrations Configuration

Go to the `Data Integrations` page

1. Create kafka resources and verify that they are available.

On the data integration page, click kafka resources, fill in the kafka connection details, and then click test. Please check the kafka service if the test fails.
![create resource](./_assets/kafka_create_resource.png)

2. Click the New button after the test is passed and you will see the Create Resource successfully message.

![kafka_created_successfully](./_assets/kafka_created_successfully.png)

3. Create a new rule

Put the following SQL statement in the SQL input field. The device reporting message time (up timestamp), client ID, and message body (Payload) will be retrieved from the temp hum/emqx subject in the SQL rule, and the device ambient temperature and humidity will be read from the message body.

```sql
SELECT

timestamp as up_timestamp, clientid as client_id, payload.temp as temp, payload.hum as hum

timestamp as up_timestamp,
clientid as client_id,
payload.temp as temp,
payload.hum as hum
FROM

"temp_hum/emqx"
```
![rule sql](./_assets/sql_test.png)
![rule sql](./_assets/kafka_create_sql.png)

3. Create a response action

Click on the `Add Action` toward the bottom of the page and select action type as `Data Forwarding` and `Bridge Data to Kafka`. Select the resource created in the first step and fill in the following data:
4. Rule SQL Testing

To see if the rule SQL fulfills our requirements, click SQL test and fill in the test payload, topic, and client information.

![rule sql](./_assets/kafka_create_sql_test.png)

5. Add Action to Rule

Click Next to add a Kafka forwarding action to the rule once the SQL test succeeds. To demonstrate how to bridge the data reported by the device to Kafka, we'll utilize the following Kafka topic and message template.
Kafka topic: emqx
Message content template:

```
# kafka topic
emqx
# kafka message template
{"up_timestamp": ${up_timestamp}, "client_id": ${client_id}, "temp": ${temp}, "hum": ${hum}}
```
![kafka action](./_assets/confluent_action.png)
5. View rules monitoring

Go back to the `Rule Engine` page to monitor the rule
![monitor](./_assets/view_monitor_confluent.png)
![rule sql](./_assets/kafka_action.png)
6. After successfully binding the action to the rule, click View Details to see the rule sql statement and the bound actions.
![monitor](./_assets/kafka_rule_engine_detail.png)
7. To see the created rules, go to Data Integrations/View Created Rules. Click the Monitor button to see the detailed match data of the rule.
![monitor](./_assets/kafka_monitor.png)
## Test
1. Use [MQTT X](https://mqttx.app/) to simulate temperature and humidity data reporting
You need to replace broker.emqx.io with the created deployment [connection address](../deployments/view_deployment.md), and add [client authentication information](../deployments/auth.md) to the EMQX Dashboard.
You need to replace broker.emqx.io with the created deployment [connection address](../deployments/view_deployment.md), add [client authentication information](../deployments/auth.md) to the EMQX Dashboard.
![MQTTX](./_assets/mqttx_publish.png)
2. View data dump results
2. View data bridging results
```bash
# Go to the Kafka instance and view the temp_hum topic
ccloud kafka topic consume -b temp_hum
# Go to the Kafka instance and view the emqx topic
$ docker exec -it mykafka /opt/kafka/bin/kafka-console-consumer.sh --bootstrap-server <broker IP>:9092 --topic emqx --from-beginning
```
![kafka](./_assets/confluent_result.png)
![kafka](./_assets/kafka_query_result.png)
Loading

0 comments on commit 8711d36

Please sign in to comment.