This topic describes message routers and message router management tasks. The message routing feature allows you to synchronize messages across regions for data consistency based on your business requirements.

What is a message router?

Message routers of Message Queue for Apache RocketMQ are used to synchronize messages across different regions to ensure data consistency. You can synchronize all messages or the messages filtered by filter conditions. For example, you can filter messages by a specific tag and then synchronize the filtered messages. Alibaba Cloud provides Express Connect based on the superb infrastructure. You do not need to manually activate Express Connect. The message routing feature allows you to synchronize messages across regions by using Express Connect. The following figure shows how the message routing feature works.

Message router
Notice
  • Fees are incurred if you use the message routing feature. For more information, see Billing overview.
  • Relay message routing is not supported. For example, messages cannot be synchronized from region A to region B and then to region C. If you want to synchronize messages from region A to region C, you must create a route from region A to region C.
  • Message routers are supported in all regions except in the Internet region.
  • The source topic and the destination topic must have the same message type. If the message type of the source topic is normal, the message type of the destination topic must also normal.
  • Latency may occur when you synchronize messages if the number of messages is too large or a network bandwidth bottleneck exists. Therefore, the time when the message arrives at the destination topic may be later than the time when the message arrives at the source topic.

Create a message router management task

You can log on to the Message Queue for Apache RocketMQ console to create a message router management task to synchronize messages across regions based on your business requirements.

Prerequisites

  • Before you create a message router management task, make sure that the source and destination regions of the messages to be synchronized support the message routing feature.
  • The source instance, source topic, destination instance, and destination topic are created and available. The source topic and the destination topic have the same message type.

For more information about how to create an instance and a topic, see Create resources or Create resources based on the protocol type.

Procedure

  1. Log on to the Message Queue for Apache RocketMQ console.
  2. In the left-side navigation pane, click Global Message Router.
  3. In the upper-left corner of the Global Message Router page, click Create Message Routing Task.
  4. In the Create Global Message Routing Task dialog box, set the parameters and click OK.
    creat_globa_message_route_button

    The following table describes the parameters.

    Parameter Description
    Message Source
    • Source Region: Select the source region of the instance to which the topic of the messages that you want to synchronize belongs.
    • Source Instance: Select the source instance to which the topic of the messages that you want to synchronize belongs.
    • Source Topic: Select the source topic of the messages that you want to synchronize.
    Message Destination
    • Destination Region: Select the destination region of the instance to which the topic of the messages that you want to synchronize belongs.
    • Destination Instance: Select the destination instance to which the topic of the messages that you want to synchronize belongs.
    • Destination Topic: Select the destination topic of the messages that you want to synchronize.
    Filtering Rule Enter the filter condition. Only messages filtered by the condition can be synchronized. You can enter a tag name to filter messages by the tag. For example, if the message tag is CartService, you can enter CartService in the Filtering Rule field. If you want to filter messages by using multiple tags, separate the tags with two vertical bars (||), for example, CartService||Inventroy||Payment. For more information, see Message filtering.
    Description Enter a description of the message router management task to identify and record each task.
    Initial Synchronization Site
    • Yes. Start the routing task immediately after creation.: The task is in the Enabled state after the task is created. The system automatically runs the task.
    • No. I want to manually start the routing task later.: The task is in the Not Enabled state after the task is created. You must manually start the task.
    After the task is created, it is displayed in the task list on the Global Message Router page.

Related operations

On the Global Message Router page, you can search for, start, stop, view, and delete the created task. You can also modify filter conditions for the task.global_massage_route_list

Search for the task

On the Global Message Router page, you can search for a task based on the source region, source instance ID, source topic, destination region, destination instance ID, and destination topic.

Start and stop the task

In the task list of the Global Message Router page, find the task and click More in the Actions column. Click Enable Rule or Disable Rule from the drop-down list to start or stop the task.

  • After the task is started, the task is in the Enabled state.
  • After the task is stopped, the task is in the Disabled state.

Delete the task

Prerequisites: You must stop a task before you delete the task.

In the task list of the Global Message Router page, find the task and click Delete in the Actions column.

Deleted tasks are no longer displayed in the search results.

View task details

In the task list of the Global Message Router page, find the task and click View Details in the Actions column to view task details and message details and modify the filter conditions. For more information, see Modify a filter condition.

router_detail_new

The following table describes the key parameters on the Task Details page.

Parameter Description
Task Status Valid values: Not Enabled, Enabled, and Disabled.
Message Synchronization TPS The value of this parameter is measured once a minute. The Message Synchronization TPS parameter specifies the number of messages that are transmitted per second.
Message Delay The time difference between the latest synchronization offset and the latest message offset.
Message Accumulated The number of messages that have not been synchronized.
Latest Synchronization Time The time when the last message synchronization occurred.

Modify a filter condition

Prerequisites: You must stop a task before you modify the filtering rule of the task.

In the Filtering Rules field of the Basic Information section, click the Modify icon to modify the filter condition.

You can enter a tag name to filter messages by the tag. For example, if the message tag is CartService, you can enter CartService in the Filtering Rule field. If you want to filter messages by using multiple tags, separate the tags with two vertical bars (||), for example, CartService||Inventroy||Payment. For more information, see Message filtering.