From 576bf8b41e2e7c56a3f300c6fb099ca4edb0a8e2 Mon Sep 17 00:00:00 2001 From: scwlkq <89067331+scwlkq@users.noreply.github.com> Date: Fri, 29 Mar 2024 15:54:42 +0800 Subject: [PATCH] [ISSUE #45] Implement methods from storage-plugin.admin(rocketmq) (#66) * modify RocketmqTopicCore, using SDKManager * fix style * delete some variable in RocketmqProperties and TopicProperties & remote additional endPoint name * remove junit dependency back to console module * remove unnecessary brackets & revert em-dashboard-pom.xml & move RocketmqProperties to core.dto * add todo * move todo to common sdk dependencies & fix style * add test and junit dependencies in core pom.xml * revert the indentation in pom.xml & move test related dependencies to bottom in core-pom.xml * revert indentation in pom.xml * revert indentation in pom.xml * remove unnecessary params * remove params * remove empty line --- eventmesh-dashboard-common/pom.xml | 24 ++++ eventmesh-dashboard-console/pom.xml | 53 +++----- .../console/controller/TopicController.java | 4 +- eventmesh-dashboard-core/pom.xml | 13 ++ .../function/SDK/AbstractSDKOperation.java | 2 +- .../core}/function/SDK/SDKManager.java | 20 ++- .../core}/function/SDK/SDKOperation.java | 4 +- .../core}/function/SDK/SDKTypeEnum.java | 2 +- .../SDK/config/CreateNacosConfig.java | 2 +- .../SDK/config/CreateRedisConfig.java | 2 +- .../SDK/config/CreateRocketmqConfig.java | 2 +- .../function/SDK/config/CreateSDKConfig.java | 2 +- .../SDK/operation/EtcdSDKOperation.java | 6 +- .../operation/NacosConfigSDKOperation.java | 8 +- .../operation/NacosNamingSDKOperation.java | 8 +- .../SDK/operation/NacosSDKOperation.java | 8 +- .../SDK/operation/RedisSDKOperation.java | 8 +- .../RocketMQProduceSDKOperation.java | 8 +- .../RocketMQPushConsumerSDKOperation.java | 8 +- .../RocketMQRemotingSDKOperation.java | 6 +- .../SDK/operation/RuntimeSDKOperation.java | 6 +- .../function/SDK/wrapper/NacosSDKWrapper.java | 2 +- .../core/store/RocketmqTopicCore.java | 126 ++++++++++++++++-- .../core}/function/SDK/SDKManagerTest.java | 7 +- .../RedisSDKCreateOperationTest.java | 6 +- .../service/dto/RocketmqProperties.java | 34 +++++ .../service/dto}/TopicProperties.java | 19 +-- .../dashboard/service/store/TopicCore.java | 11 +- pom.xml | 1 + 29 files changed, 270 insertions(+), 132 deletions(-) rename {eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console => eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core}/function/SDK/AbstractSDKOperation.java (94%) rename {eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console => eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core}/function/SDK/SDKManager.java (83%) rename {eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console => eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core}/function/SDK/SDKOperation.java (88%) rename {eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console => eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core}/function/SDK/SDKTypeEnum.java (94%) rename {eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console => eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core}/function/SDK/config/CreateNacosConfig.java (93%) rename {eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console => eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core}/function/SDK/config/CreateRedisConfig.java (93%) rename {eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console => eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core}/function/SDK/config/CreateRocketmqConfig.java (95%) rename {eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console => eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core}/function/SDK/config/CreateSDKConfig.java (93%) rename {eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console => eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core}/function/SDK/operation/EtcdSDKOperation.java (82%) rename {eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console => eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core}/function/SDK/operation/NacosConfigSDKOperation.java (86%) rename {eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console => eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core}/function/SDK/operation/NacosNamingSDKOperation.java (86%) rename {eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console => eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core}/function/SDK/operation/NacosSDKOperation.java (87%) rename {eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console => eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core}/function/SDK/operation/RedisSDKOperation.java (82%) rename {eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console => eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core}/function/SDK/operation/RocketMQProduceSDKOperation.java (85%) rename {eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console => eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core}/function/SDK/operation/RocketMQPushConsumerSDKOperation.java (86%) rename {eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console => eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core}/function/SDK/operation/RocketMQRemotingSDKOperation.java (87%) rename {eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console => eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core}/function/SDK/operation/RuntimeSDKOperation.java (82%) rename {eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console => eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core}/function/SDK/wrapper/NacosSDKWrapper.java (94%) rename {eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console => eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core}/function/SDK/SDKManagerTest.java (90%) rename {eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console => eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core}/function/SDK/operation/RedisSDKCreateOperationTest.java (91%) create mode 100644 eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/dto/RocketmqProperties.java rename {eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model => eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/dto}/TopicProperties.java (66%) diff --git a/eventmesh-dashboard-common/pom.xml b/eventmesh-dashboard-common/pom.xml index 108b059b..d6c277c5 100644 --- a/eventmesh-dashboard-common/pom.xml +++ b/eventmesh-dashboard-common/pom.xml @@ -40,6 +40,30 @@ fastjson2 2.0.40 + + + + + io.lettuce + lettuce-core + + + + com.alibaba.nacos + nacos-client + ${nacos.version} + + + + org.apache.rocketmq + rocketmq-client + ${rocketmq.version} + + + org.apache.rocketmq + rocketmq-tools + ${rocketmq.version} + \ No newline at end of file diff --git a/eventmesh-dashboard-console/pom.xml b/eventmesh-dashboard-console/pom.xml index 231d865c..c68e5a8e 100644 --- a/eventmesh-dashboard-console/pom.xml +++ b/eventmesh-dashboard-console/pom.xml @@ -37,6 +37,19 @@ spring-aspects + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + 4.13.2 + test + + org.springdoc @@ -59,19 +72,13 @@ org.mybatis.spring.boot mybatis-spring-boot-starter + com.mysql mysql-connector-j runtime - - - com.alibaba.nacos - nacos-client - ${nacos.version} - - @@ -93,38 +100,8 @@ - - - io.lettuce - lettuce-core - - - - org.apache.rocketmq - rocketmq-client - 4.9.4 - - - org.apache.rocketmq - rocketmq-tools - 5.2.0 - - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - junit - junit - 4.13.2 - test - + diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/TopicController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/TopicController.java index 1f6c601b..c8f92ff8 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/TopicController.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/TopicController.java @@ -18,9 +18,9 @@ package org.apache.eventmesh.dashboard.console.controller; import org.apache.eventmesh.dashboard.common.dto.Result; -import org.apache.eventmesh.dashboard.common.model.TopicProperties; import org.apache.eventmesh.dashboard.console.dto.CreateTopicRequest; import org.apache.eventmesh.dashboard.console.dto.DeleteTopicRequest; +import org.apache.eventmesh.dashboard.service.dto.TopicProperties; import org.apache.eventmesh.dashboard.service.store.TopicCore; import java.util.List; @@ -61,7 +61,7 @@ public ResponseEntity preflight() { @CrossOrigin @GetMapping public Result> getList() { - List topicList = topicCore.getTopic(); + List topicList = topicCore.getTopics(); return Result.success(topicList); } diff --git a/eventmesh-dashboard-core/pom.xml b/eventmesh-dashboard-core/pom.xml index 61d9a01d..22cdbd99 100644 --- a/eventmesh-dashboard-core/pom.xml +++ b/eventmesh-dashboard-core/pom.xml @@ -65,5 +65,18 @@ rocketmq-client 4.9.7 + + + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + 4.13.2 + test + \ No newline at end of file diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/AbstractSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/AbstractSDKOperation.java similarity index 94% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/AbstractSDKOperation.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/AbstractSDKOperation.java index c2e5b964..d9ad2a70 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/AbstractSDKOperation.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/AbstractSDKOperation.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.function.SDK; +package org.apache.eventmesh.dashboard.core.function.SDK; public abstract class AbstractSDKOperation implements SDKOperation { diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/SDKManager.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKManager.java similarity index 83% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/SDKManager.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKManager.java index 9ac4dbdc..43822e30 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/SDKManager.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKManager.java @@ -15,16 +15,16 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.function.SDK; +package org.apache.eventmesh.dashboard.core.function.SDK; -import org.apache.eventmesh.dashboard.console.function.SDK.config.CreateSDKConfig; -import org.apache.eventmesh.dashboard.console.function.SDK.operation.NacosConfigSDKOperation; -import org.apache.eventmesh.dashboard.console.function.SDK.operation.NacosNamingSDKOperation; -import org.apache.eventmesh.dashboard.console.function.SDK.operation.NacosSDKOperation; -import org.apache.eventmesh.dashboard.console.function.SDK.operation.RedisSDKOperation; -import org.apache.eventmesh.dashboard.console.function.SDK.operation.RocketMQProduceSDKOperation; -import org.apache.eventmesh.dashboard.console.function.SDK.operation.RocketMQPushConsumerSDKOperation; -import org.apache.eventmesh.dashboard.console.function.SDK.operation.RocketMQRemotingSDKOperation; +import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.NacosConfigSDKOperation; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.NacosNamingSDKOperation; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.NacosSDKOperation; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.RedisSDKOperation; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.RocketMQProduceSDKOperation; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.RocketMQPushConsumerSDKOperation; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.RocketMQRemotingSDKOperation; import java.util.AbstractMap.SimpleEntry; import java.util.Map; @@ -32,10 +32,8 @@ import java.util.concurrent.ConcurrentHashMap; - /** * SDK manager is a singleton to manage all SDK clients, it is a facade to create, delete and get a client. - */ public class SDKManager { diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/SDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKOperation.java similarity index 88% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/SDKOperation.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKOperation.java index 19d264c5..8e9e9ecd 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/SDKOperation.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKOperation.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.function.SDK; +package org.apache.eventmesh.dashboard.core.function.SDK; -import org.apache.eventmesh.dashboard.console.function.SDK.config.CreateSDKConfig; +import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig; import java.util.AbstractMap.SimpleEntry; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/SDKTypeEnum.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKTypeEnum.java similarity index 94% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/SDKTypeEnum.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKTypeEnum.java index 9a44873d..d01efa1c 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/SDKTypeEnum.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKTypeEnum.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.function.SDK; +package org.apache.eventmesh.dashboard.core.function.SDK; public enum SDKTypeEnum { diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/config/CreateNacosConfig.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateNacosConfig.java similarity index 93% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/config/CreateNacosConfig.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateNacosConfig.java index 856d4de5..2fd8ef0f 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/config/CreateNacosConfig.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateNacosConfig.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.function.SDK.config; +package org.apache.eventmesh.dashboard.core.function.SDK.config; import lombok.Data; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/config/CreateRedisConfig.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRedisConfig.java similarity index 93% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/config/CreateRedisConfig.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRedisConfig.java index 30c53b89..a4577491 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/config/CreateRedisConfig.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRedisConfig.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.function.SDK.config; +package org.apache.eventmesh.dashboard.core.function.SDK.config; import lombok.Data; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/config/CreateRocketmqConfig.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRocketmqConfig.java similarity index 95% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/config/CreateRocketmqConfig.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRocketmqConfig.java index 89424e70..19ea6d49 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/config/CreateRocketmqConfig.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRocketmqConfig.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.function.SDK.config; +package org.apache.eventmesh.dashboard.core.function.SDK.config; import org.apache.rocketmq.client.consumer.listener.MessageListener; import org.apache.rocketmq.common.protocol.heartbeat.MessageModel; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/config/CreateSDKConfig.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateSDKConfig.java similarity index 93% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/config/CreateSDKConfig.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateSDKConfig.java index 9a404f2e..23b3c110 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/config/CreateSDKConfig.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateSDKConfig.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.function.SDK.config; +package org.apache.eventmesh.dashboard.core.function.SDK.config; /** * Config to create an SDK client, usually contains an address url. diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/EtcdSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/EtcdSDKOperation.java similarity index 82% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/EtcdSDKOperation.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/EtcdSDKOperation.java index 75beaf69..3f483c1f 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/EtcdSDKOperation.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/EtcdSDKOperation.java @@ -15,10 +15,10 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.function.SDK.operation; +package org.apache.eventmesh.dashboard.core.function.SDK.operation; -import org.apache.eventmesh.dashboard.console.function.SDK.AbstractSDKOperation; -import org.apache.eventmesh.dashboard.console.function.SDK.config.CreateSDKConfig; +import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation; +import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig; import java.util.AbstractMap.SimpleEntry; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/NacosConfigSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosConfigSDKOperation.java similarity index 86% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/NacosConfigSDKOperation.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosConfigSDKOperation.java index 0757f7bc..cea39d6a 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/NacosConfigSDKOperation.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosConfigSDKOperation.java @@ -15,11 +15,11 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.function.SDK.operation; +package org.apache.eventmesh.dashboard.core.function.SDK.operation; -import org.apache.eventmesh.dashboard.console.function.SDK.AbstractSDKOperation; -import org.apache.eventmesh.dashboard.console.function.SDK.config.CreateNacosConfig; -import org.apache.eventmesh.dashboard.console.function.SDK.config.CreateSDKConfig; +import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation; +import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateNacosConfig; +import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig; import java.util.AbstractMap.SimpleEntry; import java.util.Properties; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/NacosNamingSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosNamingSDKOperation.java similarity index 86% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/NacosNamingSDKOperation.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosNamingSDKOperation.java index 54fcd05b..b6707b3f 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/NacosNamingSDKOperation.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosNamingSDKOperation.java @@ -15,11 +15,11 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.function.SDK.operation; +package org.apache.eventmesh.dashboard.core.function.SDK.operation; -import org.apache.eventmesh.dashboard.console.function.SDK.AbstractSDKOperation; -import org.apache.eventmesh.dashboard.console.function.SDK.config.CreateNacosConfig; -import org.apache.eventmesh.dashboard.console.function.SDK.config.CreateSDKConfig; +import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation; +import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateNacosConfig; +import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig; import java.util.AbstractMap.SimpleEntry; import java.util.Properties; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/NacosSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosSDKOperation.java similarity index 87% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/NacosSDKOperation.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosSDKOperation.java index e0b326e7..c3651f6c 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/NacosSDKOperation.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosSDKOperation.java @@ -15,11 +15,11 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.function.SDK.operation; +package org.apache.eventmesh.dashboard.core.function.SDK.operation; -import org.apache.eventmesh.dashboard.console.function.SDK.AbstractSDKOperation; -import org.apache.eventmesh.dashboard.console.function.SDK.config.CreateSDKConfig; -import org.apache.eventmesh.dashboard.console.function.SDK.wrapper.NacosSDKWrapper; +import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation; +import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig; +import org.apache.eventmesh.dashboard.core.function.SDK.wrapper.NacosSDKWrapper; import java.util.AbstractMap.SimpleEntry; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RedisSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RedisSDKOperation.java similarity index 82% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RedisSDKOperation.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RedisSDKOperation.java index ec50d422..5fd3d4f1 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RedisSDKOperation.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RedisSDKOperation.java @@ -15,11 +15,11 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.function.SDK.operation; +package org.apache.eventmesh.dashboard.core.function.SDK.operation; -import org.apache.eventmesh.dashboard.console.function.SDK.AbstractSDKOperation; -import org.apache.eventmesh.dashboard.console.function.SDK.config.CreateRedisConfig; -import org.apache.eventmesh.dashboard.console.function.SDK.config.CreateSDKConfig; +import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation; +import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRedisConfig; +import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig; import java.util.AbstractMap.SimpleEntry; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RocketMQProduceSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RocketMQProduceSDKOperation.java similarity index 85% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RocketMQProduceSDKOperation.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RocketMQProduceSDKOperation.java index 2dde6c30..c1f46a74 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RocketMQProduceSDKOperation.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RocketMQProduceSDKOperation.java @@ -15,11 +15,11 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.function.SDK.operation; +package org.apache.eventmesh.dashboard.core.function.SDK.operation; -import org.apache.eventmesh.dashboard.console.function.SDK.AbstractSDKOperation; -import org.apache.eventmesh.dashboard.console.function.SDK.config.CreateRocketmqConfig; -import org.apache.eventmesh.dashboard.console.function.SDK.config.CreateSDKConfig; +import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation; +import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRocketmqConfig; +import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig; import org.apache.rocketmq.client.exception.MQClientException; import org.apache.rocketmq.client.producer.DefaultMQProducer; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RocketMQPushConsumerSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RocketMQPushConsumerSDKOperation.java similarity index 86% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RocketMQPushConsumerSDKOperation.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RocketMQPushConsumerSDKOperation.java index f25d4df0..b55a6632 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RocketMQPushConsumerSDKOperation.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RocketMQPushConsumerSDKOperation.java @@ -15,11 +15,11 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.function.SDK.operation; +package org.apache.eventmesh.dashboard.core.function.SDK.operation; -import org.apache.eventmesh.dashboard.console.function.SDK.AbstractSDKOperation; -import org.apache.eventmesh.dashboard.console.function.SDK.config.CreateRocketmqConfig; -import org.apache.eventmesh.dashboard.console.function.SDK.config.CreateSDKConfig; +import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation; +import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRocketmqConfig; +import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig; import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer; import org.apache.rocketmq.client.exception.MQClientException; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RocketMQRemotingSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RocketMQRemotingSDKOperation.java similarity index 87% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RocketMQRemotingSDKOperation.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RocketMQRemotingSDKOperation.java index 3c88ff4e..f98dc724 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RocketMQRemotingSDKOperation.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RocketMQRemotingSDKOperation.java @@ -15,10 +15,10 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.function.SDK.operation; +package org.apache.eventmesh.dashboard.core.function.SDK.operation; -import org.apache.eventmesh.dashboard.console.function.SDK.AbstractSDKOperation; -import org.apache.eventmesh.dashboard.console.function.SDK.config.CreateSDKConfig; +import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation; +import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig; import org.apache.rocketmq.remoting.RemotingClient; import org.apache.rocketmq.remoting.netty.NettyClientConfig; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RuntimeSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeSDKOperation.java similarity index 82% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RuntimeSDKOperation.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeSDKOperation.java index 65d358c8..d630bc09 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RuntimeSDKOperation.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeSDKOperation.java @@ -15,10 +15,10 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.function.SDK.operation; +package org.apache.eventmesh.dashboard.core.function.SDK.operation; -import org.apache.eventmesh.dashboard.console.function.SDK.AbstractSDKOperation; -import org.apache.eventmesh.dashboard.console.function.SDK.config.CreateSDKConfig; +import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation; +import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig; import java.util.AbstractMap.SimpleEntry; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/wrapper/NacosSDKWrapper.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/wrapper/NacosSDKWrapper.java similarity index 94% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/wrapper/NacosSDKWrapper.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/wrapper/NacosSDKWrapper.java index 7f9e3ffa..a0c0858a 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/wrapper/NacosSDKWrapper.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/wrapper/NacosSDKWrapper.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.function.SDK.wrapper; +package org.apache.eventmesh.dashboard.core.function.SDK.wrapper; import com.alibaba.nacos.api.config.ConfigService; import com.alibaba.nacos.api.exception.NacosException; diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/store/RocketmqTopicCore.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/store/RocketmqTopicCore.java index 5dba4c23..b3810f0c 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/store/RocketmqTopicCore.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/store/RocketmqTopicCore.java @@ -17,42 +17,142 @@ package org.apache.eventmesh.dashboard.core.store; -import org.apache.eventmesh.dashboard.common.model.TopicProperties; -import org.apache.eventmesh.dashboard.core.config.AdminProperties; +import org.apache.eventmesh.dashboard.core.function.SDK.SDKManager; +import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum; +import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig; +import org.apache.eventmesh.dashboard.service.dto.RocketmqProperties; +import org.apache.eventmesh.dashboard.service.dto.TopicProperties; import org.apache.eventmesh.dashboard.service.store.TopicCore; +import org.apache.commons.lang3.StringUtils; +import org.apache.rocketmq.common.TopicConfig; +import org.apache.rocketmq.common.TopicFilterType; +import org.apache.rocketmq.common.constant.PermName; +import org.apache.rocketmq.common.protocol.RequestCode; +import org.apache.rocketmq.common.protocol.body.TopicConfigSerializeWrapper; +import org.apache.rocketmq.common.protocol.header.CreateTopicRequestHeader; +import org.apache.rocketmq.common.protocol.header.DeleteTopicRequestHeader; +import org.apache.rocketmq.remoting.CommandCustomHeader; +import org.apache.rocketmq.remoting.RemotingClient; +import org.apache.rocketmq.remoting.protocol.RemotingCommand; + +import java.util.ArrayList; import java.util.List; +import java.util.concurrent.ConcurrentMap; +import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import lombok.extern.slf4j.Slf4j; -/** - * TODO implement methods from storage-plugin.admin - */ - @Slf4j @Service public class RocketmqTopicCore implements TopicCore { - AdminProperties adminProperties; + private final RocketmqProperties rocketmqProperties; + + private RemotingClient createRemotingClient(String brokerUrl) { + CreateSDKConfig createSDKConfig = () -> brokerUrl; + + SDKManager.getInstance().createClient(SDKTypeEnum.STORAGE_ROCKETMQ_REMOTING, createSDKConfig); + return (RemotingClient) SDKManager.getInstance().getClient(SDKTypeEnum.STORAGE_ROCKETMQ_REMOTING, brokerUrl); + } + - public RocketmqTopicCore(AdminProperties adminProperties) { - this.adminProperties = adminProperties; + public RocketmqTopicCore(RocketmqProperties rocketmqProperties) { + this.rocketmqProperties = rocketmqProperties; } @Override - public List getTopic() { - return null; + public Boolean createTopic(String topicName) { + String namesrvAddr = rocketmqProperties.getNamesrvAddr(); + long requestTimeoutMillis = rocketmqProperties.getRequestTimeoutMillis(); + if (StringUtils.isEmpty(namesrvAddr)) { + log.info("RocketmqTopicCore-createTopic failed, missing brokerUrl"); + return Boolean.FALSE; + } + + RemotingClient remotingClient = (RemotingClient) SDKManager.getInstance().getClient(SDKTypeEnum.STORAGE_ROCKETMQ_REMOTING, namesrvAddr); + if (remotingClient == null) { + remotingClient = createRemotingClient(namesrvAddr); + } + try { + CreateTopicRequestHeader requestHeader = new CreateTopicRequestHeader(); + requestHeader.setTopic(topicName); + requestHeader.setTopicFilterType(TopicFilterType.SINGLE_TAG.name()); + requestHeader.setPerm(PermName.PERM_READ | PermName.PERM_WRITE); + + RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.UPDATE_AND_CREATE_TOPIC, requestHeader); + RemotingCommand response = remotingClient.invokeSync(namesrvAddr, request, requestTimeoutMillis); + log.info("Rocketmq create topic result:" + response.toString()); + return response.getCode() == 0; + } catch (Exception e) { + log.error("RocketmqTopicCore-createTopic failed.", e); + } + return Boolean.FALSE; } @Override - public void createTopic(String topicName) { + public List getTopics() { + String namesrvAddr = rocketmqProperties.getNamesrvAddr(); + long requestTimeoutMillis = rocketmqProperties.getRequestTimeoutMillis(); + if (StringUtils.isEmpty(namesrvAddr)) { + log.info("RocketmqTopicCore-getTopics failed, missing brokerUrl"); + return new ArrayList<>(); + } + + RemotingClient remotingClient = (RemotingClient) SDKManager.getInstance().getClient(SDKTypeEnum.STORAGE_ROCKETMQ_REMOTING, namesrvAddr); + if (remotingClient == null) { + remotingClient = createRemotingClient(namesrvAddr); + } + List topicConfigList = new ArrayList<>(); + try { + RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_ALL_TOPIC_CONFIG, (CommandCustomHeader) null); + RemotingCommand response = remotingClient.invokeSync(namesrvAddr, request, requestTimeoutMillis); + TopicConfigSerializeWrapper allTopicConfig = TopicConfigSerializeWrapper.decode(response.getBody(), TopicConfigSerializeWrapper.class); + ConcurrentMap topicConfigTable = allTopicConfig.getTopicConfigTable(); + topicConfigList = new ArrayList<>(topicConfigTable.values()); + } catch (Exception e) { + log.error("RocketmqTopicCore-createTopic failed.", e); + } + return topicConfig2TopicProperties(topicConfigList); } @Override - public void deleteTopic(String topicName) { + public Boolean deleteTopic(String topicName) { + String namesrvAddr = rocketmqProperties.getNamesrvAddr(); + long requestTimeoutMillis = rocketmqProperties.getRequestTimeoutMillis(); + if (StringUtils.isEmpty(namesrvAddr)) { + log.info("RocketmqTopicCore-deleteTopic failed, missing brokerUrl"); + return Boolean.FALSE; + } + + RemotingClient remotingClient = (RemotingClient) SDKManager.getInstance().getClient(SDKTypeEnum.STORAGE_ROCKETMQ_REMOTING, namesrvAddr); + if (remotingClient == null) { + remotingClient = createRemotingClient(namesrvAddr); + } + try { + DeleteTopicRequestHeader deleteTopicRequestHeader = new DeleteTopicRequestHeader(); + deleteTopicRequestHeader.setTopic(topicName); + RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.DELETE_TOPIC_IN_BROKER, null); + RemotingCommand response = remotingClient.invokeSync(namesrvAddr, request, requestTimeoutMillis); + + log.info("Rocketmq delete topic result:" + response.toString()); + return response.getCode() == 0; + } catch (Exception e) { + log.error("RocketmqTopicCore-createTopic failed.", e); + } + return Boolean.FALSE; + } + public List topicConfig2TopicProperties(List topicConfigList) { + ArrayList topicPropertiesList = new ArrayList<>(); + for (TopicConfig topicConfig : topicConfigList) { + TopicProperties topicProperties = new TopicProperties(); + BeanUtils.copyProperties(topicConfig, topicProperties); + topicPropertiesList.add(topicProperties); + } + return topicPropertiesList; } } diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/SDK/SDKManagerTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKManagerTest.java similarity index 90% rename from eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/SDK/SDKManagerTest.java rename to eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKManagerTest.java index 4eccdb0f..d243fa78 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/SDK/SDKManagerTest.java +++ b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKManagerTest.java @@ -15,17 +15,20 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.function.SDK; +package org.apache.eventmesh.dashboard.core.function.SDK; import static org.junit.jupiter.api.Assertions.assertNotNull; -import org.apache.eventmesh.dashboard.console.function.SDK.config.CreateRedisConfig; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRedisConfig; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import lombok.extern.slf4j.Slf4j; + @Slf4j class SDKManagerTest { diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RedisSDKCreateOperationTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RedisSDKCreateOperationTest.java similarity index 91% rename from eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RedisSDKCreateOperationTest.java rename to eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RedisSDKCreateOperationTest.java index 33a06b8e..ec90f29c 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RedisSDKCreateOperationTest.java +++ b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RedisSDKCreateOperationTest.java @@ -15,11 +15,11 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.function.SDK.operation; +package org.apache.eventmesh.dashboard.core.function.SDK.operation; import static org.junit.jupiter.api.Assertions.assertEquals; -import org.apache.eventmesh.dashboard.console.function.SDK.config.CreateRedisConfig; +import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRedisConfig; import java.util.AbstractMap.SimpleEntry; @@ -29,8 +29,6 @@ import lombok.extern.slf4j.Slf4j; - - @Slf4j class RedisSDKCreateOperationTest { diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/dto/RocketmqProperties.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/dto/RocketmqProperties.java new file mode 100644 index 00000000..b17e9af5 --- /dev/null +++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/dto/RocketmqProperties.java @@ -0,0 +1,34 @@ +/* + * 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.eventmesh.dashboard.service.dto; + +import lombok.Data; + +@Data +public class RocketmqProperties { + + private String namesrvAddr; + + private String clusterName; + + private String accessKey; + + private String secretKey; + + private long requestTimeoutMillis = 10000L; +} \ No newline at end of file diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/TopicProperties.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/dto/TopicProperties.java similarity index 66% rename from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/TopicProperties.java rename to eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/dto/TopicProperties.java index 49decb7c..4eedc694 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/TopicProperties.java +++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/dto/TopicProperties.java @@ -15,26 +15,19 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.common.model; +package org.apache.eventmesh.dashboard.service.dto; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; /** * One record displayed in 'Topic' page. */ +@Data public class TopicProperties { - public String name; - public long messageCount; + private String topicName; + + private int offset; - @JsonCreator - public TopicProperties( - @JsonProperty("name") String name, - @JsonProperty("messageCount") long messageCount) { - super(); - this.name = name; - this.messageCount = messageCount; - } } diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/store/TopicCore.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/store/TopicCore.java index 2b37e53f..2e637725 100644 --- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/store/TopicCore.java +++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/store/TopicCore.java @@ -17,7 +17,7 @@ package org.apache.eventmesh.dashboard.service.store; -import org.apache.eventmesh.dashboard.common.model.TopicProperties; +import org.apache.eventmesh.dashboard.service.dto.TopicProperties; import java.util.List; @@ -27,12 +27,9 @@ public interface TopicCore { - /** - * TODO rename to getTopics after being implemented - */ - List getTopic(); + List getTopics(); - void createTopic(String topicName); + Boolean createTopic(String topicName); - void deleteTopic(String topicName); + Boolean deleteTopic(String topicName); } diff --git a/pom.xml b/pom.xml index fd0ac3f0..e6dfb520 100644 --- a/pom.xml +++ b/pom.xml @@ -81,6 +81,7 @@ 2.7.6 2.3.2 2.1.2 + 4.9.8