Creating a Metadata Migration Task
Function
This API is used to create a metadata migration task.
URI
POST /v2/{project_id}/instances/{instance_id}/metadata
Parameter | Mandatory | Type | Description |
---|---|---|---|
project_id | Yes | String | Project ID. For details, see Obtaining a Project ID. |
instance_id | Yes | String | Instance ID. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
overwrite | Yes | String | true: Configurations in the metadata file with the same name as the uploaded file will be overwritten. false: An error is reported when a topic or group already exists. |
name | Yes | String | Migration task name. For details about the naming rules, see the API for creating an instance. |
type | Yes | String | Migration task type. The value can be rocketmq or rabbitToRocket. |
Request Parameters
Parameter | Mandatory | Type | Description |
---|---|---|---|
topicConfigTable | No | Map<String,MigrationRocketMqTopicConfig> | RocketMQ instance topic metadata. The topic name is the key and the topic configuration is the value. This parameter is mandatory for rocketmq migration tasks (from self-built RocketMQ instances to DMS for RocketMQ). |
subscriptionGroupTable | No | Map<String,MigrationRocketMqSubscriptionGroup> | RocketMQ consumer group metadata. The consumer group name is the key and the configuration is the value. This parameter is mandatory for rocketmq migration tasks (from self-built RocketMQ instances to DMS for RocketMQ). |
vhosts | No | Array of MigrationRabbitVhostMetadata objects | RabbitMQ virtual host metadata list. This parameter is mandatory for rabbitToRocket migration tasks (from self-built RabbitMQ instances to DMS for RocketMQ). |
queues | No | Array of MigrationRabbitQueueMetadata objects | RabbitMQ queue metadata list. This parameter is mandatory for rabbitToRocket migration tasks (from self-built RabbitMQ instances to DMS for RocketMQ). |
exchanges | No | Array of MigrationRabbitExchangeMetadata objects | RabbitMQ exchange metadata list. This parameter is mandatory for rabbitToRocket migration tasks (from self-built RabbitMQ instances to DMS for RocketMQ). |
bindings | No | Array of MigrationRabbitBindingMetadata objects | RabbitMQ binding metadata list. This parameter is mandatory for rabbitToRocket migration tasks (from self-built RabbitMQ instances to DMS for RocketMQ). |
Parameter | Mandatory | Type | Description |
---|---|---|---|
topicName | No | String | Topic name. |
order | No | Boolean | Indicates whether a message is an ordered message. |
perm | No | Integer | Topic permission. |
readQueueNums | No | Integer | Number of read queues. |
writeQueueNums | No | Integer | Number of write queues. |
topicFilterType | No | String | Topic filtering type.
|
topicSysFlag | No | Integer | Topic system flag. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
groupName | No | String | Consumer group name. |
consumeBroadcastEnable | No | Boolean | Indicates whether to enable broadcast. |
consumeEnable | No | Boolean | Indicates whether to enable consumption. |
consumeFromMinEnable | No | Boolean | Indicates whether to enable consumption from the earliest offset. |
notifyConsumerIdsChangedEnable | No | Boolean | Indicates whether to notify consumer ID changes. |
retryMaxTimes | No | Integer | Maximum number of consumption retries. |
retryQueueNums | No | Integer | Number of retry queues. |
whichBrokerWhenConsumeSlow | No | Long | ID of the broker selected for slow consumption. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
name | No | String | Virtual host name. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
vhost | No | String | Virtual host name. |
name | No | String | Queue name. |
durable | No | Boolean | Indicates whether to enable data persistence. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
vhost | No | String | Virtual host name. |
name | No | String | Switch name. |
type | No | String | Exchange type. |
durable | No | Boolean | Indicates whether to enable data persistence. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
vhost | No | String | Virtual host name. |
source | No | String | Message source. |
destination | No | String | Message target. |
destination_type | No | String | Message target type. |
routing_key | No | String | Routing key. |
Response Parameters
Status code: 200
Parameter | Type | Description |
---|---|---|
task_id | String | Task ID. |
Example Requests
Creating a metadata migration task to migrate the metadata from other vendors' or self-built RocketMQ instances to DMS for RocketMQ.
POST https://{endpoint}/v2/{project_id}/instances/{instance_id}/metadata?overwrite=true&name=task-123&type=rocketmq{"topicConfigTable" : {"topic-test1" : {"order" : false,"perm" : 6,"readQueueNums" : 3,"topicFilterType" : "SINGLE_TAG","topicName" : "topic-test1","topicSysFlag" : 0,"writeQueueNums" : 3}},"subscriptionGroupTable" : {"group-test1" : {"consumeBroadcastEnable" : true,"consumeEnable" : true,"consumeFromMinEnable" : true,"groupName" : "group-test1","notifyConsumerIdsChangedEnable" : true,"retryMaxTimes" : 2,"retryQueueNums" : 1,"whichBrokerWhenConsumeSlow" : 1}}}Creating a metadata migration task to migrate the metadata of RabbitMQ instances to DMS for RocketMQ.
POST https://{endpoint}/v2/{project_id}/instances/{instance_id}/metadata?overwrite=true&name=task-123&type=rabbitToRocket{"vhosts" : [ {"name" : "DeleteVhost123"} ],"queues" : [ {"name" : "test-001","vhost" : "/","durable" : false} ],"exchanges" : [ {"name" : "direct","vhost" : "/","type" : "topic","durable" : false} ],"bindings" : [ {"source" : "direct","vhost" : "/","destination" : "test-001","destination_type" : "queue","routing_key" : "test-001"} ]}
Example Responses
Status code: 200
Successful
{"task_id" : "6cf4dcd3-8471-4139-8b5b-8a3a71f704c7"}
Status Codes
Status Code | Description |
---|---|
200 | Successful |
Error Codes
See Error Codes.
- URI