All Products
Search
Document Center

Message router

Last Updated: Apr 25, 2019

Background information

Message routers are often used to synchronize messages between different regions to ensure data consistency. Relying on Express Connect developed by Alibaba Cloud based on its superb infrastructure (there is no need to activate Express Connect separately), RocketMQ message routers allow you to efficiently synchronize messages from countries to countries and regions to regions. The following figure shows the implementation.

messagerouter

The RocketMQ message routers allow you to synchronize messages under a topic of an instance in one region to another topic of a specified instance in another region by specifying the source region, target region, source instance, target instance, source topic, and target topic, and configuring the message filtering rules (such as by tag) and the synchronization start point.

Note:

  • Relay message routing is not supported. For example, messages cannot be synchronized from region A to region B and then to region C. If needed, create a task to synchronize messages from region A to region C directly.

  • Currently, message routers are not supported in Internet.

  • The message types of the source topic and target topic must be consistent. If the message type of the source topic is normal message, that of the target topic to be synchronized should also be normal message.

  • Considering the number of messages to be synchronized and the network bandwidth bottleneck, message synchronization may encounter certain latency. That is, the time when the message arrives at the target topic is later than the time when the message enters the source topic.

Create a message router task

You can log on to the RocketMQ console, create a cross-region message synchronization task based on your business needs, and track and manage the task.

Prerequisites

  • Before creating a message router task, make sure that the source and target regions of the message to be synchronized support the message router function.

  • The source instance, source topic, target instance, and target topic have been created and available. The message types of the source topic and target topic are the same.

For more information about how to create an instance and a topic, see the procedures for creating a resource in Quick start for primary accounts or Quick start for sub-accounts according to the type of your account.

Procedure

To create a message synchronization task, perform the following steps:

  1. Log on to the RocketMQ console.

  2. In the left-side navigation pane, choose Message Router.

  3. In upper-right corner of the Message Router page, click Create Task.

  4. In the Create Task dialog box, set the following parameters and click OK. The following table describes the parameters.

Parameter Description
Source Region Select the source region of the instance of the topic for the message that you want to synchronize.
Source Instance Select the source instance of the topic for the message that you want to synchronize.
Source Topic Enter the name of the source topic of the message that you want to synchronize.
Target region Select the target region of the instance of the topic for the message that you want to synchronize.
Target Instance Select the target instance of the topic for the message that you want to synchronize.
Target Topic Enter the name of the target topic of the message that you want to synchronize.
Sync Starting Point Select the message synchronization starting point in the message queue of the source topic. All the messages that queue up after the specified point are synchronized to the target topic. Currently, only Last Offset is supported, that is, starting synchronization from the latest message in the queue.
Filtering Rule Enter the filtering rule. Only the message filtered according to the rule can be synchronized. You can filter messages by tag, that is, directly entering the tag name such as “TagA”. For more information, see Message filtering.
Description Enter the specific description or remarks for the message synchronization task for distinguishing and recording.

After the task is created, it is displayed in the task list on the Message Router page.

Note: After the message router task is created successfully, the task is in the Initializing state, and you need to start the task manually.

On the Message Router page, you can search, start, stop, view, and delete the created task. You can also edit filtering rules for the task.

Search for a task

On the Message Router page, set Source and Target, and click Search to query the required task.

Start and stop a task

In the task list on the Message Router page, locate the row that contains the target task, and click Start or Stop in the Actions column.

  • After the task is started, the status of the task changes to Running.

  • After the task is stopped, the status of the task changes to Stopped.

Delete a task

Prerequisites: You must stop the task before deleting it.

In the task list on the Message Router page, locate the row that contains the target task, and click Delete in the Actions column.

The deleted task is no longer displayed in the search results.

View task details

In the task list on the Message Router page, locate the row that contains the target task, and click View Details in the Actions column to view the task details and message details. You can also edit the filtering rule.

The following table describes the key fields in the Task Details area.

Parameter Description
Task Status The task status can be Initializing, Running, or Stopped.
Sync TPS The TPS value of messages transmitted per second in message synchronization, measured once a minute.
Message Delay The time difference between the latest synchronization point and the latest message.
Message Accumulation Amount The number of messages that have not been synchronized yet.
Latest Sync Time The time when the last message synchronization occurred.

Edit a filtering rule

Prerequisites: You must stop the task before editing the filtering rule.

In the Filtering Rule field of the Task Details area, click the edit icon to edit the filtering rule.