When you migrate from one ApsaraMQ for RocketMQ instance to another or maintain identical topic configurations across development, testing, and production environments, manually recreating topics is tedious and error-prone. The topic data export and import feature lets you export topic metadata from a source instance as an .xlsx file and import it into a destination instance to automatically recreate topics.
Export and import transfers only topic metadata -- names, message types, and descriptions. Messages stored in the topics are not affected or migrated. Cross-version export and import is supported. For example, you can export from a 4.x instance and import into a 5.x instance.
Use cases
Instance migration: Export topic data from an ApsaraMQ for RocketMQ 4.x instance and import it into a 5.x instance. All topics are recreated automatically on the new instance.
Environment cloning: Define topics once, then export and import them across development, testing, and production instances to keep configurations in sync.
Prerequisites
Before you begin, ensure that you have:
An ApsaraMQ for RocketMQ instance with existing topics (source)
An ApsaraMQ for RocketMQ instance to receive the topics (destination)
Access to the ApsaraMQ for RocketMQ console
Export topic data
Log on to the ApsaraMQ for RocketMQ console. In the left-side navigation pane, click Instances.
In the top navigation bar, select a region, such as China (Hangzhou). On the Instances page, click the name of the source instance.
In the left-side navigation pane, click Topics.
In the upper-right corner of the Topics page, click the
icon.
The topic data is saved to an .xlsx file on your local machine.
Import topic data
Import the exported .xlsx file directly, or update it based on your business requirements before importing.
File format requirements
The .xlsx file must contain the following columns:
| Parameter | Description | Valid values |
|---|---|---|
| TopicName | The topic name. | Letters, digits, underscores (\_), and hyphens (-). Must be 1 to 60 characters. Cannot contain reserved system strings or special prefixes. For details, see Limits on parameters. |
| MessageType | The message type of the topic. | TRANSACTION: transactional messages. DELAY: scheduled or delayed messages. FIFO: ordered messages. NORMAL: normal messages. |
| Remark | A description of the topic. | 1 to 60 characters. |
Example:
| TopicName | MessageType | Remark |
|---|---|---|
| Topic1 | TRANSACTION | Used to send transactional messages. |
| Topic2 | NORMAL | Used to send normal messages. |
| Topic3 | DELAY | Used to send delayed messages. |
Import steps
Log on to the ApsaraMQ for RocketMQ console. In the left-side navigation pane, click Instances.
In the top navigation bar, select a region, such as China (Hangzhou). On the Instances page, click the name of the destination instance.
In the left-side navigation pane, click Topics.
In the upper-right corner of the Topics page, click the
icon.Select the .xlsx file and click Open.
In the Import Resources panel, select the topics to import and click Confirm and Import in the Actions column. To import multiple topics at once, select them and click Batch Import.
After the Execution Results column shows Imported for each topic, click OK in the lower-left corner of the Import Resources panel.
The imported topics now appear in the topic list of the destination instance.