tencent cloud

Migration Guide for TencentCloud API Related to RocketMQ 4.X Cluster Role
Last updated: 2025-07-15 18:35:42
Migration Guide for TencentCloud API Related to RocketMQ 4.X Cluster Role
Last updated: 2025-07-15 18:35:42

Background Note

Due to historical reasons, subproducts under the TDMQ product family share certain APIs. For example, Pulsar and RocketMQ have existing clusters that share Role-related TencentCloud APIs. To achieve the smallest granularity for permission isolation, RocketMQ subsequently introduced a separate Role-based management API. For customers using these shared TencentCloud APIs, TDMQ RocketMQ will notify them individually.
This document guides customers to better replace TencentCloud APIs. If you have not used the following shared APIs, you can ignore this document.

Relevant APIs

Historic Shared API Name
Description
Replace API
CreateRole
Creating a Role
CreateRocketMQRole
DeleteRoles
Deleting the Role
DeleteRocketMQRoles
DescribeRoles
Get role list
DescribeRocketMQRoles
ModifyRole
Role modification
ModifyRocketMQRole
ModifyEnvironmentRole
Modify environment role authorization
ModifyRocketMQEnvironmentRole
CreateEnvironmentRole
Create environment role authorization
CreateRocketMQEnvironmentRole
DescribeEnvironmentRoles
Namespace role list
DescribeRocketMQEnvironmentRoles
DeleteEnvironmentRoles
Delete environment role authorization
DeleteRocketMQEnvironmentRoles
DescribeMsgTrace
Querying the Message Trace
DescribeRocketMQMsgTrace
ModifyVipInstanceState
Modify dedicated instance status
ModifyRocketMQVipInstanceState
DescribeAppIdStats
Retrieve user information
DescribeRocketMQAppIdStats

Migrating Example Code

During migration, only the instantiated request object needs to be altered to a RocketMQ-related object. Here, we take the API migration from CreateRole to CreateRocketMQRole as an example, using SDK integration with Java as the development language.

Old API Integration

package com.tencent;

import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.profile.HttpProfile;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.tdmq.v20200217.TdmqClient;
import com.tencentcloudapi.tdmq.v20200217.models.*;

public class Sample
{
public static void main(String [] args) {
try{
// Instantiate an authentication object. Input parameters require passing in secretId and secretKey of the cloud account. Keep the confidentiality of the key pair.
// The key can be obtained at https://console.tencentcloud.com/cam/capi.
Credential cred = new Credential("", "");
// Instantiate an HTTP option, optional, which can be skipped if there is no special requirement.
HttpProfile httpProfile = new HttpProfile();
// Recommended for use Polaris. Relevant guidelines are accessible at the following link
// https://git.woa.com/tencentcloud-internal/tencentcloud-sdk-java#%E5%8C%97%E6%9E%81%E6%98%9F
httpProfile.setEndpoint("tdmq.ap-guangzhou.tencentcloudapi.woa.com");
// Instantiate a client option, optional, which can be skipped if there is no special requirement.
ClientProfile clientProfile = new ClientProfile();
clientProfile.setHttpProfile(httpProfile);
// Instantiate the client object to request the product, and clientProfile is optional.
TdmqClient client = new TdmqClient(cred, "", clientProfile);
// Instantiate a request object. Each interface will correspond to a request object.
CreateRoleRequest req = new CreateRoleRequest();
// The returned resp is an instance of CreateRoleResponse, corresponding to the request object
CreateRoleResponse resp = client.CreateRole(req);
// Output string in json format.
System.out.println(resp);
} catch (TencentCloudSDKException e) {
System.out.println(e.toString());
}
}
}

New API Integration

package com.tencent;


import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.profile.HttpProfile;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.tdmq.v20200217.TdmqClient;
import com.tencentcloudapi.tdmq.v20200217.models.*;

public class Sample
{
public static void main(String [] args) {
try{
// Instantiate an authentication object. Input parameters require passing in secretId and secretKey of the cloud account. Keep the confidentiality of the key pair.
// The key can be obtained at https://console.tencentcloud.com/cam/capi.
Credential cred = new Credential("", "");
// Instantiate an HTTP option, optional, which can be skipped if there is no special requirement.
HttpProfile httpProfile = new HttpProfile();
// Recommended for use Polaris. Relevant guidelines are accessible at the following link
// https://git.woa.com/tencentcloud-internal/tencentcloud-sdk-java#%E5%8C%97%E6%9E%81%E6%98%9F
httpProfile.setEndpoint("tdmq.ap-guangzhou.tencentcloudapi.woa.com");
// Instantiate a client option, optional, which can be skipped if there is no special requirement.
ClientProfile clientProfile = new ClientProfile();
clientProfile.setHttpProfile(httpProfile);
// Instantiate the client object to request the product, and clientProfile is optional.
TdmqClient client = new TdmqClient(cred, "", clientProfile);
// Instantiate a request object. Each interface will correspond to a request object.
CreateRocketMQRoleRequest req = new CreateRocketMQRoleRequest();
// The returned resp is an instance of CreateRocketMQRoleResponse, corresponding to the request object
CreateRocketMQRoleResponse resp = client.CreateRocketMQRole(req);
// Output string in json format.
System.out.println(resp);
} catch (TencentCloudSDKException e) {
System.out.println(e.toString());
}
}
}





Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback