当前位置:网站首页>Eventbridge integrated cloud service practice
Eventbridge integrated cloud service practice
2022-04-22 09:03:00 【Alibaba cloud native】
author : Li Kai ( Kay )
EvenBridge Integration Overview
EventBridge Alibaba cloud launched a serverless event bus , Its goal is to expand the event ecology , Break the data island between systems , Establish an event integration ecosystem . Provide unified event standardized access and management capabilities , Improve the integration and integrated path , Help customers quickly realize the core atomic functions driven by events , Can be EventBridge Quickly integrate into BPM、RPA、CRM Such as system .

EventBridge Standardize through events , Access Standardization , Component standardization is expanded in three directions as a fulcrum EventBridge Event ecology :
• Standardization of events : hug CloudEvents 1.0 Open source community standard protocol , Native support CloudEvents Community SDK and API, Fully embrace the standard ecology of open source community events ;
• Access Standardization : Provide standard event push protocol PutEvent, And support Pull and Push Two event access models , It can effectively reduce the difficulty of event access , Provide a complete standardized process for event access on the cloud ;
• Component Standardization : Encapsulate the standard event downstream component tool chain system , Include Schema register 、 Event analysis 、 Event Retrieval 、 Event dashboard, etc . Provide perfect event tool chain ecology .
In the field of integration EventBridge Focus on creating two core scenarios: Event Integration and data integration , The following will focus on these two types of scenarios .
Event integration
at present EventBridge Already owned 80+ The event source of cloud products ,800+ Types of events . The whole event ecology is still gradually enriching .

that ,EventBridge How to realize the event integration of cloud products ?
• First, in the EventBridge The console can see a file named default Event bus of , Events of cloud products will be delivered to this bus ;

• Then click Create rule , You can select the concerned cloud products and their related events for event monitoring and delivery .

Here are two examples , Take a look EventBridge The way of Event Integration .
OSS Event integration
With OSS Take the event source as an example , Let's explain how to integrate OSS event .

OSS Events are now mainly divided into 4 class , Operational audit related 、 Cloud monitoring related 、 Configure audit related 、 And events related to cloud products, such as PutObject Upload files and so on . The event sources of other cloud products are similar , Basically, they can be divided into these types of events .
Here is a demonstration of the event driven online file decompression service :

• stay OSS Bucket There's going to be a zip The folder stores the files that need to be unzipped , One unzip Folder to store the extracted files ;
• When uploading files to OSS Bucket after , The event of file upload will be triggered and delivered to EventBridge Cloud service private bus ;
• Then an event rule will be used to filter zip This bucket And deliver it to the... Of the decompression service HTTP Endpoint;
• The decompression service will after receiving the event , According to the file path in the event OSS Download the file and extract it , And after decompression, transfer the file to unzip Under the table of contents ;
• meanwhile , There will also be an event rule , monitor unzip File upload event of directory , And push the event to the nail group after conversion .
Let's take a look at how it is realized :
Go to the link below to view the video :
https://www.bilibili.com/video/BV1s44y1g7dk/
1) First create a bucket, There is a zip Directory is used to store uploaded compressed files , One unzip Directory is used to store decompressed files .

- Deploy decompression service , And expose the address accessed by the public network .
The source address of the decompression service is :
https://github.com/AliyunContainerService/serverless-k8s-examples/tree/master/oss-unzip?spm=a2c6h.12873639.article-detail.15.5a585d52apSWbk
You can also use ASK Direct deployment ,yaml The file address is :
https://github.com/AliyunContainerService/serverless-k8s-examples/blob/master/oss-unzip/hack/oss-unzip.yaml
3) Create an event rule to listen to zip The event of uploading files under the directory , And deliver it to the... Of the decompression service HTTP Endpoint.

Use here subject, matching zip Catalog .
4) Then create an event rule to listen unzip Directory Events , Deliver the decompression event to the nail group .

The same thing is used here subject, matching unzip Catalog .
For the configuration of variables and templates, please refer to the official documents :
https://help.aliyun.com/document_detail/181429.html.
EventBridge Will pass JSONPath To extract parameters from events , Then put these values into variables , Finally, the final output is rendered through the definition of the template and delivered to the event target .OSS The event format of the event source can also refer to the official document :
https://help.aliyun.com/document_detail/205739.html#section-g8i-7p9-xpk , And use... According to the actual business needs JSONPath Defining variables .5) Last , adopt oss Upload a file to the console for verification .


You can see just uploaded eventbridge.zip It has been unzipped and uploaded , It can also be in the nail group , Receive the notice of decompression completion . Besides , You can also view the delivered track of the event content on the event tracking side .

You can see that there are two upload events : One is the event uploaded through the console , One is the event of uploading after decompressing the file .

You can view the track , Have been successfully delivered to the decompression service HTTP Endpoint And the nail robot .
Integrate cloud products by customizing event sources and event targets of cloud products
Just demonstrated demo It is the event source of integrated cloud services , Let's go through another demo Let's see how to integrate cloud products by customizing event sources and cloud product event targets .
Go to the link below to view the video :
https://www.bilibili.com/video/BV1QF411M7xv/
This demo The final effect is through EventBridge Automatic data cleaning , And deliver it to RDS In the middle . The content of the event is a JSON, Has two fields, one name, one age , Now hope will be greater than 10 Year old users are filtered out and stored in RDS in .

The overall structure is as shown in the figure , Use one MNS Queue As a custom event source , And pass EventBridge Filter and transform events and eventually output them directly to RDS In the middle .

1) First, you have created a MNS Queue, Create one RDS Instance and database table , The table structure is as follows :

2) Create a custom event bus , Select the event provider as MNS, Queues are queues created in advance ;

When it's created , We can see a running event source here ;

3) Next, create rules and post them to RDS

The configured event mode is as follows :
{
"source": [ "my.user" ], "data": {
"messageBody": {
"age": [
{
"numeric": [
">",
10
]
}
]
}
}
}
For numerical matching, please refer to the official document :
https://help.aliyun.com/document_detail/181432.html#section-dgh-5cq-w6c
- Click next , Select the event target as the database , Fill in the database information , Configure conversion rules , Finish creating .

5) Last , First use MNS Queue Send a message , This one. age It is greater than 10 Of .

You can see that this event is output to RDS Inside the .

Let's send another one less than 10 The news came to MNS Queue.

This event is filtered out , No output to RDS.

You can also view events through event tracking :

You can see that an event has been successfully delivered to RDS, An event is filtered out , No delivery .
Data integration
The event flow is EventBridge Provide a more lightweight for data integration 、 Real time end-to-end event flow test channel , The main goal is to synchronize events between two endpoints , At the same time, it provides filtering and conversion functions . At present, Alibaba cloud has supported event flow among its messaging products .

Different from the event bus model , In the flow of events , No event bus is required , Its 1:1 The model is lighter , The direct to target approach also makes events more real-time ; Through event flow , We can realize the protocol conversion between different systems , Data synchronization , The ability to backup across regions .

The following will explain how to use event flow through an example , take RocketMQ Your message is routed to MNS Queue, Integrate the two products .
The overall structure is as shown in the figure , adopt EventBridge take RocketMQ in TAG by MNS Your message is routed to MNQ Queue.

Let's see how to achieve :
Go to the link below to view the video :
https://www.bilibili.com/video/BV1D44y1G7GK/
• First, create an event flow , Select source RocketMQ example , Fill in Tag by mns.


• Leave the event pattern content blank to match all .

• Target selection MNS, Select the target queue to complete the creation .

• When you're done creating , Click start , Start the event flow task .
After the event flow is started , We can use the console or SDK Send message to source RocketMQ Topic Inside . When there is Tag by mns When , We can see that the message is routed to mns; When there is Tag Not for mns When , Messages will not be routed to mns.
summary
This article mainly shares with you through EventBridge How to integrate cloud product event sources , How to integrate cloud products, event targets and message products through event flow , Want to know more EventBridge Related information , Scan the QR code below to join the nail group ~

Click on here , Learn more about EventBridge Related information ~
版权声明
本文为[Alibaba cloud native]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220818186285.html
边栏推荐
- [path of system analyst] real topic of case analysis of system analyst in 2020
- 合并两个有序链表(迭代)
- Scope and lifecycle of variables
- CMake基础知识二之实例单个文件,多个文件,动静态库及使用
- Concept and understanding of memory address
- Insert sorting and optimization
- Section I: the first step of portrait refinement - reasonable transfer
- ==与equals
- 如何清空输入缓冲区
- QT文件读写实战教程
猜你喜欢
随机推荐
51 single chip microcomputer learning_ 3-3 independent key control LED binary display
getchar函数的返回类型
51 single chip microcomputer learning_ 3-2 independent key control LED status
解读智慧农业未来发展
==与equals
使用docker搭建适合thinkphp5的lnmp+redis开发环境
【系统分析师之路】2020年下系统分析师案例分析真题
QT文件读写实战教程
Blue Bridge Cup: dance of sine [Jav language implemented recursively]
2022 high voltage electrician test simulation 100 questions and answers
Concept and understanding of memory address
2022 high altitude installation, maintenance and demolition of special operation permit examination question bank and simulated examination platform operation
素数求解的N种境界
宝宝起名神器小程序源码_支持多种流量主模式
开源,不只 coding
51 单片机学习_3-4 独立按键控制发光LED左移&右移
Cmake使用基础知识一之基础语法
玩转Kubernetes—基础概念篇
C语言实现【关机程序】
LeetCode 1450 - 1453

![Binary search [detailed explanation]](/img/a0/0ae626b4b8cc742fccde3bd7c3e4a4.png)







