Eventbridge Message Routing

EventBridge message routing Solution


EventBridge message routing.In the process of enterprise digital transformation, it is natural to encounter scenarios such as message routing, remote multi-activity, protocol adaptation, and message backup. This article mainly introduces the application scenarios and application experiments of EventBridge message routing to help you understand how to efficiently build message routing capabilities through EventBridge 's message routing.

Background knowledge

EventBridge message routing mainly involves the following cloud products and services:

Event bus EventBridge

Event bus EventBridge is a serverless event bus service provided by Alibaba Cloud. It supports Alibaba Cloud services, custom applications, and SaaS applications to access in a standardized and centralized manner, and can use the standardized CloudEvents 1.0 protocol between these applications. Route events to help you easily build loosely coupled, distributed event-driven architectures.

•Message Queuing for RabbitMQ

EventBridge message routing.Alibaba Cloud's message queue RabbitMQ version supports the AMQP protocol and is fully compatible with the RabbitMQ open source ecosystem and multi-language clients, creating a distributed, high-throughput, low-latency, and highly scalable cloud messaging service. Out-of-the-box, users do not need to deploy without operation and maintenance , and can easily achieve fast cloud access. Alibaba Cloud provides fully managed services, which are more professional, more reliable, and more secure.

EventBridge message routing.Message Queuing MNS Edition



EventBridge message routing.EventBridge message routing.Alibaba Cloud Message Service MNS version is an efficient, reliable, secure, convenient, and elastically scalable distributed message notification service. MNS can help application developers to freely pass data, notify messages on the distributed components of their applications, and build loosely coupled systems.

EventBridge message routing.Scenario application


EventBridge message routing function is mainly used in the following three scenarios in the process of building a message system. One is the message routing scenario, the second is the message multi-activity scenario, and the third is the multi-protocol adaptation scenario. These three scenarios are briefly described below. introduce.

EventBridge message routing.message routing scenarios

This scenario refers to the scenario where you want to redistribute messages, and distribute messages to other topics or cross-regional topics through simple filtering or filtering to achieve message sharing & message desensitization.

EventBridge message routing.Distributing messages to different topics for consumption through a layer of forwarding is the core capability of message routing. With the transformation of enterprises, there will be more and more scenarios of news splitting and business desensitization. The following figure is a typical routing diversion scenario.

EventBridge message.News scene

EventBridge message routing.The multi-active message scenario means that each data center deploys a complete and independent MQ cluster. The application services in the data center only connect to the local MQ cluster, not to the MQ clusters of other units. The message routing module included in the MQ cluster is responsible for synchronizing messages on the specified topic between different unit MQ clusters.

EventBridge message routing.According to whether the application service has the unitization capability, it can be divided into two categories: central service and unit service. The central service only provides services in one data center; the unit service provides services in each data center, but is only responsible for some users who meet the rules, not all users.

EventBridge message routing.All data centers that deploy unit services are a unit, and the unit services of all units provide external services at the same time, thus forming a remote multi-active architecture or a unitized architecture. Through the multi-active management and control platform, the traffic that each unit service is responsible for can be dynamically adjusted.

EventBridge message.Multi-protocol adaptation scenarios



As the business team grows larger, the demand for message construction is increasing day by day. Due to the different technology stacks of departments, the message protocols between departments are also different. Multi-protocol adaptation refers to the ability to smoothly migrate from one message protocol to multiple message protocols.

Architecture description

Use EventBridge 's event stream capability for message routing. The event stream model is the main processing model of EventBridge in the message field. It is suitable for standard Streaming (1:1) stream processing scenarios and has no bus concept. It is used for end-to-end message routing, message dumping, message synchronization and processing, etc., to help developers easily build data pipeline services on the cloud .

The following architecture shows how to route MNS messages to RabbitMQ Queues, MNS Queues by bridging EventBridge . (A/B link chooses one to test)

application experiment

Target

Through the operation of this experimental tutorial, you can create a message routing service in the event bus console through the Alibaba Cloud console, and implement message routing and simple message desensitization in the EventBridge console.

After experiencing this experiment, the knowledge that can be acquired is:


•Create a message routing task;
•Create RabbitMQ instance, MNS instance and simple message sending.

resource

The resources used are as follows: (The resources in this experiment follow the principle of minimum, and use the minimum resources that meet the needs of the scene)


•Resource 1 : EventBridge event bus
•Resource 2: Alibaba Cloud Message Queue RabbitMQ version
•Resource 3: Alibaba Cloud Message Queue MNS version

step

1)EventBridge message routing. Create MNS resource

This experiment is divided into two optional scenarios A/B:

A. The scene is delivered to MNS Queues2 through MNS Queues1
B. The scene is delivered to RabbitMQ Queues through MNS Queues1


Different scenes can be selected according to interests.

This step will guide you how to create a Message Queuing MNS version through the console.

Log in to the Alibaba Cloud console with your own Alibaba Cloud account, and then access the Message Queuing MNS console. [1]

In the left navigation bar of the console, click Queue List. (The resource region can be the same region, and Hangzhou is selected by default for this guide)

On the list page, click Create Queue and fill in the name information "test- mns -q"

After creation, click "Details"

Find the MNS public network access point information, and remember this information, which will be used in subsequent experiments.

2) EventBridge message routing.Create RabbitMQ resources (optional for B experiment)

This step will guide you on how to create a message queue for RabbitMQ through the console.

Log in to the Alibaba Cloud console with your own Alibaba Cloud account, and then access the message queue RabbitMQ version console. [2]

In the left navigation bar of the console, click Instance List. (The resource region can be the same region, and Hangzhou is selected by default for this guide)

On the list page, click Create Instance and complete the creation.

After the creation is complete, click Details to enter the instance details page;

Create " test-amqp -v " in "Vhost list";

In "Queue List", select Vhost as " test-amqp -v", and create " test-amqp -q";

3).EventBridge message routing.Create EventBridge event flow task - MNS TO MNS (optional for A experiment)

EventBridge event stream through the console .

Log in to the Alibaba Cloud console with your own Alibaba Cloud account, and then access the EventBridge console. [3]

Note: It needs to be activated for the first use.

Click the "Event Stream" list, and create a task in the list (the resource region can be the same region, this guide selects Hangzhou by default)

Create an event stream named "test-amqp-mns2mns", click Next;

Specify the event source, the event provider is "Message Service MNS", the queue name is "test- mns - q", and click Next;

Specify the rule, the rule part can not be filtered, the default matches all, just click Next;

Note: The content of the rules can be specified according to your needs. In order to reduce the difficulty of this experiment , all are delivered by default. For more details, please refer to:

Select "Message Service MNS" for the service type, "test-mns-q2" for the queue name, "Partial Events" for the message content, and click Create

Note: The content of the message can be specified according to your needs. The data field is delivered by default in this experiment. For more details, please refer to:

After the creation is complete, you can click "Start" to start the event flow

4) EventBridge message routing.Create EventBridge event flow task - MNS TO RabbitMQ (B experiment optional)

EventBridge event stream through the console .

Log in to the Alibaba Cloud console with your own Alibaba Cloud account, and then access the EventBridge console. [3] Note: It needs to be activated for the first use.

Click the "Event Stream" list, and create a task in the list (the resource region can be the same region, this guide selects Hangzhou by default)

Create an event stream named "test-amqp-mns2rabbitmq", click Next

Specify the event source, the event provider is "Message Service MNS", the queue name is "test- mns - q", and click Next

Specify the rule, the rule part can not be filtered, the default matches all, just click Next

Note: The content of the rules can be specified according to your needs. In order to reduce the difficulty of this experiment, all are delivered by default. For more details, please refer to:

Select "Message Queue RabbitMQ Version" for the service type, the specific configuration is as follows, click Create

Instance ID: Select the created RabbitMQ ID
Vhost : select " test-amqp -v"
Destination Type: Select "Queue"
Queue: select " test-amqp -q"
Body: Select "Partial Events" and fill in "$.data"
MessageId : Select "Constant" and fill in "0"
Properties: Select "Partial Events" and fill in "$.source"

Note: The content of the message can be specified according to your needs. The data field is delivered by default in this experiment. For more details, please refer to:

After the creation is complete, you can click "Start" to start the event flow


5) EventBridge message routing.Verify the routing task

Send an experiment message

to MNS Source “ test- mns -q” and click to download MNS SDK [4]

Modify sample.cfg

Fill in the AccessKeyId , AccessKeySecret , Endpoint and other information in " sample.cfg "

AccessKeyId and AccessKeySecret can be created in the Alibaba Cloud RAM console [5]

Endpoint is step 1, MNS public network access point address
AccessKeyId = xxxxxxx
AccessKeySecret = xxxxxxx
Endpoint = http://1825725063814405.mns.cn-hangzhou.aliyuncs.com

Fill in the effect as follows, save
Find the "sendmessage.py" example in the sample directory

Advantages and Summary

EventBridge event flow provides end-to-end message routing capabilities, and can complete message distribution, message synchronization, cross-regional message backup, and cross-product message synchronization through simple configuration. It has the advantages of simple operation and maintenance, low cost, high efficiency and stable use. At the same time, using EventBridge can realize basic data processing capabilities such as data filtering and data desensitization. It is the solution with the lowest operation and maintenance cost in the message routing scenario .






Related Articles

Explore More Special Offers

  1. Short Message Service(SMS) & Mail Service

    50,000 email package starts as low as USD 1.99, 120 short messages start at only USD 1.00