Federation tasks

更新时间:
复制 MD 格式

Federation tasks use EventBridge event streams to implement the open-source Federation Plugin capability. By configuring a federation task, you can synchronize and replicate metadata and messages across clusters.

Usage notes

Important
  • Federation tasks currently support only exchange federation (exchange-to-exchange message synchronization). Queue federation is not yet available.

  • Make sure that the maximum message size on the destination RabbitMQ instance is at least equal to the maximum message size on the source instance. If the destination limit is lower, messages that exceed the limit fail to route, which causes message synchronization to fail.

Billing

Federation tasks incur additional fees. The total cost consists of two components:

Total cost = ApsaraMQ for RabbitMQ fees + EventBridge forwarding fees

  • ApsaraMQ for RabbitMQ pricing: For more information, see the ApsaraMQ for RabbitMQ billing documentation.

  • EventBridge pricing: For more information, see the EventBridge billing documentation.

Prerequisites

  • ApsaraMQ for RabbitMQ instances: The source instance and Vhost or the destination instance and Vhost are created and available.

  • EventBridge is activated.

  • Open-source RabbitMQ cluster (if applicable): If the source or destination is an open-source RabbitMQ cluster, make sure the rabbitmq_event_exchange plugin is enabled. For more information, see Enable the rabbitmq_event_exchange plugin.

Create a federation task

To create a federation task, complete the following steps: create a task, authorize the service, configure cluster information, configure task parameters, and verify the task status.

Step 1: Create a task

  1. Log on to the ApsaraMQ for RabbitMQ console.

  2. In the left-side navigation pane, click Federation Tasks.

  3. On the Federation Tasks page, click Create Task.

Step 2: Authorize the service

When you create a federation task for the first time, the system automatically creates a service-linked role named AliyunServiceRoleForEventBridgeRabbitMQPlugin.

In the Alibaba Cloud Service Authorization dialog box, review the authorization details and click Confirm.

Role description: AliyunServiceRoleForEventBridgeRabbitMQPlugin is a service-linked role that allows EventBridge to implement the RabbitMQ plugin capability.

Step 3: Configure cluster information

On the federation task configuration page, configure the source and destination cluster information.

Cluster configuration parameters

Category

Parameter

Description

Example

Open-source RabbitMQ

URL

The endpoint of the open-source RabbitMQ cluster. The default port is 5672.

192.168.1.1

Username

The username for the open-source RabbitMQ cluster.

admin

Password

The password for the open-source RabbitMQ cluster.

pass***word

VPC

The VPC ID of the network where the open-source RabbitMQ cluster resides.

vpc-2zehiozskjdbb3***

vSwitch

The vSwitch ID of the network where the open-source RabbitMQ cluster resides.

vsw-m5hksicnqou22***

Security group

The security group ID of the host where the open-source RabbitMQ cluster is deployed.

sg-2ca1jjhsdxciap***

Virtual Host

The Vhost of the open-source RabbitMQ cluster.

test-001

ApsaraMQ for RabbitMQ

Instance

The instance ID of the ApsaraMQ for RabbitMQ instance.

amqp-cn-s1q2ksbq***

Virtual Host

The Vhost of the ApsaraMQ for RabbitMQ instance.

test-001

Step 4: Configure task parameters

On the task parameters page, configure the task settings.

Task parameter configuration

Category

Parameter

Description

Options / Example

Task parameters

Task name

The name of the federation task.

federation-task-001

Ordering

Specifies whether messages are synchronized in order:
1. Concurrent: Messages are synchronized concurrently without guaranteed ordering.
2. Sequential: Messages are synchronized in the order they arrive at the exchange.

- Concurrent
- Sequential

Federation exchange parameters

Max hops

The maximum number of hops that a message can traverse across federation links. Messages that exceed this limit are dropped.

1

Exchange expression

A regular expression that matches one or more exchange names. Exchanges that match this expression are synchronized to the source cluster.

.*

Step 5: Verify the task status

On the Federation Tasks page, you can see the task you created. The initial status is Starting.

When the status changes to Running, the federation task is successfully started.

Best practices

1. Plan Max hops carefully

  • For simple point-to-point synchronization, set the value to 1.

  • For multi-hop federation topologies, set the value based on the actual topology depth.

  • Avoid setting an excessively large value to prevent messages from being forwarded in a loop.

2. Use precise exchange expressions

  • Use precise regular expressions to match only the exchanges you need to synchronize.

  • Avoid broad expressions such as .* to prevent synchronizing unnecessary exchanges.

  • Examples:

    • Match all exchanges that start with "order": ^order.*

    • Match specific exchanges by name: ^(order|payment|inventory)$

3. Choose the right ordering mode

  • Concurrent: Best for scenarios where message ordering is not critical. Provides higher throughput.

  • Sequential: Best for scenarios that require strict message ordering, such as order processing or state transitions.

4. Monitor and set up alerts

  • Periodically check the federation task status.

  • Configure alerts for message backlogs.

  • Monitor synchronization latency to detect issues early.

5. Plan your network

  • Make sure that the network latency between the source and destination clusters is within an acceptable range.

  • For cross-region synchronization, consider using Express Connect or a VPN to improve network stability.

  • Plan your VPC and security group rules to ensure network connectivity.

FAQ

The federation task is stuck in the "Starting" state. What should I do?

Check the following items:

  1. Verify that the source and destination clusters have network connectivity.

  2. Verify that the cluster credentials (username and password) are correct.

  3. Verify that EventBridge is activated and authorized.

  4. Check the console for error messages and troubleshoot accordingly.

How do I troubleshoot message synchronization delays or losses?

  1. Delays: Check the network bandwidth usage and consider optimizing message sizes or increasing bandwidth.

  2. Losses: Verify that the message size limit on the destination instance is at least equal to the limit on the source instance. Check whether the Max hops setting is appropriate. Verify that the exchange expression correctly matches the target exchanges.

Can I modify a federation task after it is created?

Federation tasks cannot be modified after creation. To change the configuration, delete the existing task and create a new one.

Does federation support bidirectional synchronization?

Federation tasks are unidirectional. To achieve bidirectional synchronization, create two federation tasks in opposite directions.

References

For more information about the open-source Federation Plugin, see Federation Plugin.