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 about how to obtain it, 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 |
Definition Whether messages are ordered. Constraints N/A Range Default Value false |
|
perm |
No |
Integer |
Definition Topic permission. Constraints N/A Range Default Value N/A |
|
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 |
Definition Whether to allow broadcast. Constraints N/A Range Default Value false |
|
consumeEnable |
No |
Boolean |
Definition Whether to enable consumption. Constraints N/A Range Default Value N/A |
|
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 |
Definition Whether to enable data persistence. Constraints N/A Range Default Value N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
vhost |
No |
String |
Virtual host name. |
|
source |
No |
String |
Message source. |
|
destination |
No |
String |
Message target. |
|
destination_type |
No |
String |
Definition Target type. Constraints N/A Range Default Value N/A |
|
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, "read_queue_nums" : 3, "topic_filter_type" : "SINGLE_TAG", "topic_name" : "topic-test1", "topic_sys_flag" : 0, "write_queue_ nums" : 3 } }, "subscriptionGroupTable" : { "group-test1" : { "consume_broadcast_enable" : true, "consume_enable" : true, "consume_from_min_enable" : true, "group_name" : "group-test1", "notify_consumer_ids_changed_enable" : true, "retry_max_times" : 2, "retry_queue_nums" : 1, "which_broker_when_consume_slow" : 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.