This is an automated email from the ASF dual-hosted git repository.
lizhimins pushed a commit to branch rocketmq-studio
in repository https://gitbox.apache.org/repos/asf/rocketmq-dashboard.git
The following commit(s) were added to refs/heads/rocketmq-studio by this push:
new afa4d9c8 [ISSUE #1507] Support all Tencent Cloud RocketMQ 5.x regions
(#1508)
afa4d9c8 is described below
commit afa4d9c8e59f2c92e14ffb8de4640682a0af3724
Author: youngkermit8-coder <[email protected]>
AuthorDate: Tue Aug 11 20:19:21 2026 +0800
[ISSUE #1507] Support all Tencent Cloud RocketMQ 5.x regions (#1508)
* [ISSUE #1507] Support all Tencent Cloud RocketMQ 5.x regions
Signed-off-by: youngkermit8-coder <[email protected]>
* [ISSUE #1507] Cover Tencent endpoint fallback cases
Signed-off-by: youngkermit8-coder <[email protected]>
---------
Signed-off-by: youngkermit8-coder <[email protected]>
---
.../provider/tencent/TencentCatalogService.java | 19 ++++++---
.../provider/tencent/TencentClientFactory.java | 9 +++-
.../tencent/TencentCatalogServiceTest.java | 10 ++++-
.../provider/tencent/TencentClientFactoryTest.java | 48 ++++++++++++++++++++++
4 files changed, 78 insertions(+), 8 deletions(-)
diff --git
a/server/src/main/java/org/apache/rocketmq/studio/provider/tencent/TencentCatalogService.java
b/server/src/main/java/org/apache/rocketmq/studio/provider/tencent/TencentCatalogService.java
index f1bf8285..bdc0015e 100644
---
a/server/src/main/java/org/apache/rocketmq/studio/provider/tencent/TencentCatalogService.java
+++
b/server/src/main/java/org/apache/rocketmq/studio/provider/tencent/TencentCatalogService.java
@@ -45,16 +45,25 @@ public class TencentCatalogService implements
CloudCatalogProvider {
static final int PAGE_SIZE = 100;
static final int MAX_PAGES = 100;
static final List<CloudRegionVO> SUPPORTED_REGIONS = List.of(
- region("ap-beijing", "Beijing"),
- region("ap-chengdu", "Chengdu"),
- region("ap-chongqing", "Chongqing"),
region("ap-guangzhou", "Guangzhou"),
- region("ap-hongkong", "Hong Kong"),
+ region("ap-shenzhen-fsi", "Shenzhen Finance"),
region("ap-nanjing", "Nanjing"),
region("ap-shanghai", "Shanghai"),
+ region("ap-shanghai-fsi", "Shanghai Finance"),
+ region("ap-shanghai-adc", "Shanghai Autonomous Driving Cloud"),
+ region("ap-hongkong", "Hong Kong"),
+ region("ap-beijing", "Beijing"),
+ region("ap-chengdu", "Chengdu"),
+ region("ap-chongqing", "Chongqing"),
region("ap-singapore", "Singapore"),
+ region("ap-bangkok", "Bangkok"),
+ region("ap-jakarta", "Jakarta"),
+ region("ap-seoul", "Seoul"),
region("ap-tokyo", "Tokyo"),
- region("na-siliconvalley", "Silicon Valley"));
+ region("na-siliconvalley", "Silicon Valley"),
+ region("na-ashburn", "Virginia"),
+ region("eu-frankfurt", "Frankfurt"),
+ region("sa-saopaulo", "Sao Paulo"));
private final TencentClientFactory clientFactory;
diff --git
a/server/src/main/java/org/apache/rocketmq/studio/provider/tencent/TencentClientFactory.java
b/server/src/main/java/org/apache/rocketmq/studio/provider/tencent/TencentClientFactory.java
index 4c04d42b..96a9b71c 100644
---
a/server/src/main/java/org/apache/rocketmq/studio/provider/tencent/TencentClientFactory.java
+++
b/server/src/main/java/org/apache/rocketmq/studio/provider/tencent/TencentClientFactory.java
@@ -78,7 +78,7 @@ public class TencentClientFactory {
.orElseThrow(() -> new BusinessException(404, "Cloud
credential not found: " + credentialId));
Credential sdkCredential = new Credential(credential.getAccessKey(),
credential.getSecretKey());
HttpProfile httpProfile = new HttpProfile();
- httpProfile.setEndpoint(ENDPOINT);
+ httpProfile.setEndpoint(endpointFor(region));
httpProfile.setConnTimeout(CONNECT_TIMEOUT_SECONDS);
httpProfile.setReadTimeout(READ_TIMEOUT_SECONDS);
ClientProfile clientProfile = new ClientProfile();
@@ -86,6 +86,13 @@ public class TencentClientFactory {
return new TrocketClient(sdkCredential, region, clientProfile);
}
+ static String endpointFor(String region) {
+ if (region != null && region.endsWith("-fsi")) {
+ return "trocket." + region + ".tencentcloudapi.com";
+ }
+ return ENDPOINT;
+ }
+
static BusinessException mapToBusinessException(TencentCloudSDKException
ex) {
String code = ex.getErrorCode();
String message = ex.getMessage();
diff --git
a/server/src/test/java/org/apache/rocketmq/studio/provider/tencent/TencentCatalogServiceTest.java
b/server/src/test/java/org/apache/rocketmq/studio/provider/tencent/TencentCatalogServiceTest.java
index 508bb7f7..446fd8e0 100644
---
a/server/src/test/java/org/apache/rocketmq/studio/provider/tencent/TencentCatalogServiceTest.java
+++
b/server/src/test/java/org/apache/rocketmq/studio/provider/tencent/TencentCatalogServiceTest.java
@@ -53,10 +53,16 @@ class TencentCatalogServiceTest {
}
@Test
- void listRegionsShouldContainChengduTest() {
+ void listRegionsShouldContainAllSupportedRocketmq5RegionsTest() {
List<CloudRegionVO> regions = service.listRegions(CREDENTIAL_ID);
-
assertThat(regions).extracting(CloudRegionVO::getRegionId).contains("ap-chengdu");
+ assertThat(regions).extracting(CloudRegionVO::getRegionId)
+ .containsExactly(
+ "ap-guangzhou", "ap-shenzhen-fsi", "ap-nanjing",
"ap-shanghai",
+ "ap-shanghai-fsi", "ap-shanghai-adc", "ap-hongkong",
"ap-beijing",
+ "ap-chengdu", "ap-chongqing", "ap-singapore",
"ap-bangkok",
+ "ap-jakarta", "ap-seoul", "ap-tokyo",
"na-siliconvalley",
+ "na-ashburn", "eu-frankfurt", "sa-saopaulo");
}
@Test
diff --git
a/server/src/test/java/org/apache/rocketmq/studio/provider/tencent/TencentClientFactoryTest.java
b/server/src/test/java/org/apache/rocketmq/studio/provider/tencent/TencentClientFactoryTest.java
new file mode 100644
index 00000000..f4b8ce71
--- /dev/null
+++
b/server/src/test/java/org/apache/rocketmq/studio/provider/tencent/TencentClientFactoryTest.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.studio.provider.tencent;
+
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+class TencentClientFactoryTest {
+
+ @Test
+ void endpointForShouldUseNearbyAccessForNonFinancialRegionsTest() {
+ assertThat(TencentClientFactory.endpointFor("ap-seoul"))
+ .isEqualTo(TencentClientFactory.ENDPOINT);
+ assertThat(TencentClientFactory.endpointFor("ap-shanghai-adc"))
+ .isEqualTo(TencentClientFactory.ENDPOINT);
+ }
+
+ @Test
+ void endpointForShouldUseNearbyAccessWhenRegionIsMissingTest() {
+ assertThat(TencentClientFactory.endpointFor(null))
+ .isEqualTo(TencentClientFactory.ENDPOINT);
+ assertThat(TencentClientFactory.endpointFor(""))
+ .isEqualTo(TencentClientFactory.ENDPOINT);
+ }
+
+ @Test
+ void endpointForShouldUseRegionalEndpointForFinancialRegionsTest() {
+ assertThat(TencentClientFactory.endpointFor("ap-shenzhen-fsi"))
+ .isEqualTo("trocket.ap-shenzhen-fsi.tencentcloudapi.com");
+ assertThat(TencentClientFactory.endpointFor("ap-shanghai-fsi"))
+ .isEqualTo("trocket.ap-shanghai-fsi.tencentcloudapi.com");
+ }
+}