Author: Zhao Hai
introduction
Event bus EventBridge is a serverless event bus service provided by Alibaba Cloud. It supports the access of Alibaba Cloud services, custom applications, and SaaS applications in a standardized and centralized manner, and can use the standardized CloudEvents 1.0 protocol between these applications. Route events between them, helping you easily build loosely coupled, distributed event-driven architectures. Event-driven architecture is a loosely coupled and distributed drive architecture. After collecting events generated by an application, necessary processing is performed on the events in real time, and then the events are routed to the downstream system without waiting for the system to respond. Using the event bus EventBridge, various simple or complex event-driven architectures can be built to connect cloud products and applications, applications and applications, etc. with the standardized CloudEvents 1.0 protocol. For more introduction to EventBridge, refer to [1] "EventBridge Event Bus and EDA Architecture Analysis"
The event target (Target) is responsible for the event processing terminal and consuming events, and is the core module of EventBridge. For other cloud vendors and DB services in vertical fields in the market, EventBridge has released a database sink based on event target modules, providing simple and easy-to-integrate DB drop-off capabilities, helping developers to realize business cloud more efficiently and conveniently.
Database Sink Overview
The database sink event target is one of the event targets supported by EventBridge. The main capability is to deliver data to the specified database table through EventBridge.
Thanks to the EventBridge ecosystem, the database sink supports many access methods:
• Alibaba Cloud product events, EventBridge supports cloud service bus, and can directly store cloud service-related events through simple configuration;
• For SaaS application events, EventBridge supports three-party SaaS event access, and supports storage and query of SaaS-triggered events;
• User-defined application, users can use EventBridge's official API interface, multi-language client, HTTP Source and open source client of CloudEvents community to complete the access.
The database sink capability focuses on how to convert the semi-structured Json data of the EventBridge business into structured SQL statements, provide LowCode interactive access, and help developers complete data storage in one stop.
Database Sink Best Practices
Typical Case:
• Hope to store some MNS consumption messages or RocketMQ consumption messages in the specified database table, which is convenient for subsequent data analysis and message checking, and data can also be added to the database table in this way;
• Store some important logs or buried point data directly in the DB through HTTP event sources, without going through the user's business system, which can facilitate subsequent customer scenario analysis.
Usage introduction:
First of all, the database Sink For MySQL currently supports two methods: one is RDS MySQL (VPC) based on Alibaba Cloud, and the other is MySQL (public network) built by users, which can be accessed in different ways according to business scenarios.
Step 1: Click on Event Rules and create an event rule
Step 2: Select the event source
You can choose Alibaba Cloud official or custom event source
Step 3: Select an event target
1) Select the database under the service type under the event target. At this time, there will be two options: one is Alibaba Cloud's RDS MySQL, and the other is self-built MySQL;
2) If it is Alibaba Cloud RDS MySQL, you need to create an associated role for the service.
3) After authorization, you can select the instance ID and database name of the RDS MySQL database created by the user.
The database account and password need to be filled in manually, and the concurrent configuration can be filled in according to actual business needs. Because RDS MySQL involves cross-regional access, it needs the support of VPC on a private network.
Step 4: Storage configuration
The storage configuration supports two methods: quick configuration and custom SQL :
1) Quick configuration, support LowCode method to quickly select storage content.
2) Custom SQL, supports custom advanced SQL syntax.
Step 5: Event Publishing
When the creation is successful, events can be published through the console:
Step 6: Event status tracking and query
You can see the detailed information of the track through the event ID in the previous step, including information such as whether the event was executed successfully or not. If the event execution fails, an exception message will be displayed on the page.
You can also see detailed event traces through event tracking:
Summarize
This article focuses on a new feature of EventBridge: the database sink event target.
As a serverless event bus service, EventBridge has integrated Alibaba Cloud product management and control link data and message product business data into the event source ecosystem, improving the convenience of cloud user business integration and meeting the requirements of Open API and multilingual SDKs. Support, on this basis, the data is delivered to the specified database table through EventBridge, which provides convenience for customers' own business access to EventBridge.
Related Links
[1] More EventBridge introduction
https://developer.aliyun.com/article/878927
[2] RDS official documentation
https://www.aliyun.com/product/rds/mysqlspm=5176.14414305.J_8058803260.32.267f5960ZjKXR3
[3] EventBridge official documentation
https://help.aliyun.com/product/161886.html
To learn more about EventBridge, scan the QR code below to join the DingTalk group~
Click here to learn more about EventBridge!
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。