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 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. Default: false |
perm |
No |
Integer |
Topic permission. Default: 6 |
readQueueNums |
No |
Integer |
Number of read queues. Default: 16 |
writeQueueNums |
No |
Integer |
Number of write queues. Default: 16 |
topicFilterType |
No |
String |
Topic filter type.
Default: SINGLE_TAG |
topicSysFlag |
No |
Integer |
Topic system flag. Default: 0 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
groupName |
No |
String |
Consumer group name. |
consumeBroadcastEnable |
No |
Boolean |
Indicates whether to enable broadcast. Default: true |
consumeEnable |
No |
Boolean |
Indicates whether to enable consumption. Default: true |
consumeFromMinEnable |
No |
Boolean |
Indicates whether to enable consumption from the earliest offset. Default: true |
notifyConsumerIdsChangedEnable |
No |
Boolean |
Indicates whether to notify consumer ID changes. Default: true |
retryMaxTimes |
No |
Integer |
Maximum number of consumption retries. Default: 16 |
retryQueueNums |
No |
Integer |
Number of retry queues. Default: 1 |
whichBrokerWhenConsumeSlow |
No |
Long |
ID of the broker selected for slow consumption. Default: 1 |
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. |
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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot