Skip to content

Commit

Permalink
[ISSUE #75] Move SDK dependencies from console and common to `cor…
Browse files Browse the repository at this point in the history
…e` module (#85)

* feat: tidy up pom, tidy up common module

* fix: set rocketmq-tools version the same as rocketmq-client

* fix: Optimize style
  • Loading branch information
Lambert-Rao authored Apr 7, 2024
1 parent efdae6e commit 6f268a0
Show file tree
Hide file tree
Showing 18 changed files with 165 additions and 84 deletions.
25 changes: 1 addition & 24 deletions eventmesh-dashboard-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
</properties>

<dependencies>
<!-- TODO: common module should not contains spring framework, considering remove this dependency -->
<!-- Spring Boot Starter -->
<dependency>
<groupId>org.springframework.boot</groupId>
Expand All @@ -40,30 +41,6 @@
<artifactId>fastjson2</artifactId>
<version>2.0.40</version>
</dependency>

<!-- todo These SDKs should be placed in the core module after the console module's usage of these SDKs has been migrated to the core module. -->
<!-- storage redis client -->
<dependency>
<groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId>
</dependency>
<!-- Meta - nacos client -->
<dependency>
<groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-client</artifactId>
<version>${nacos.version}</version>
</dependency>
<!-- rocketmq client -->
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-client</artifactId>
<version>${rocketmq.version}</version>
</dependency>
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-tools</artifactId>
<version>${rocketmq.version}</version>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* 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.common.constant;

public class StoreTypeConstant {
public static final String STORE_TYPE_TYPE_UNKNOWN = "unknown";
public static final String STORE_TYPE_STANDALONE = "standalone";
public static final String STORE_TYPE_REDIS = "redis";
public static final String STORE_TYPE_MYSQL = "mysql";
public static final String STORE_TYPE_ROCKETMQ = "rocketmq4";
public static final String STORE_TYPE_KAFKA = "kafka";
public static final String STORE_TYPE_PULSAR = "pulsar";
public static final String STORE_TYPE_RABBITMQ = "rabbitmq";
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package org.apache.eventmesh.dashboard.common.constant.health;

import org.apache.eventmesh.dashboard.common.constant.StoreTypeConstant;

public class HealthCheckTypeConstant {

public static final String HEALTH_CHECK_TYPE_UNKNOWN = "unknown";
Expand All @@ -28,11 +30,9 @@ public class HealthCheckTypeConstant {
public static final String HEALTH_CHECK_TYPE_META = "meta";
public static final String HEALTH_CHECK_TYPE_TOPIC = "topic";

public static final String HEALTH_CHECK_SUBTYPE_REDIS = "redis";
public static final String HEALTH_CHECK_SUBTYPE_MYSQL = "mysql";
public static final String HEALTH_CHECK_SUBTYPE_ROCKETMQ_BROKER = "rocketmq4-broker";
public static final String HEALTH_CHECK_SUBTYPE_ROCKETMQ_NAMESERVER = "rocketmq4-nameserver";
public static final String HEALTH_CHECK_SUBTYPE_ROCKETMQ_TOPIC = "rocketmq4-topic";
public static final String HEALTH_CHECK_SUBTYPE_REDIS = StoreTypeConstant.STORE_TYPE_REDIS;
public static final String HEALTH_CHECK_SUBTYPE_MYSQL = StoreTypeConstant.STORE_TYPE_MYSQL;
public static final String HEALTH_CHECK_SUBTYPE_ROCKETMQ = StoreTypeConstant.STORE_TYPE_ROCKETMQ;

public static final String HEALTH_CHECK_SUBTYPE_NACOS_CONFIG = "nacos-config";
public static final String HEALTH_CHECK_SUBTYPE_NACOS_REGISTRY = "nacos-registry";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,51 @@

package org.apache.eventmesh.dashboard.common.enums;

import static org.apache.eventmesh.dashboard.common.constant.StoreTypeConstant.STORE_TYPE_KAFKA;
import static org.apache.eventmesh.dashboard.common.constant.StoreTypeConstant.STORE_TYPE_PULSAR;
import static org.apache.eventmesh.dashboard.common.constant.StoreTypeConstant.STORE_TYPE_RABBITMQ;
import static org.apache.eventmesh.dashboard.common.constant.StoreTypeConstant.STORE_TYPE_REDIS;
import static org.apache.eventmesh.dashboard.common.constant.StoreTypeConstant.STORE_TYPE_ROCKETMQ;
import static org.apache.eventmesh.dashboard.common.constant.StoreTypeConstant.STORE_TYPE_STANDALONE;

import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
public enum StoreType {

STANDALONE(0, "Standalone"),
ROCKETMQ(1, "RocketMQ"),
KAFKA(2, "Kafka"),
PULSAR(3, "Pulsar"),
RABBITMQ(4, "RabbitMQ"),
REDIS(5, "Redis");
STANDALONE(0, STORE_TYPE_STANDALONE),
ROCKETMQ(1, STORE_TYPE_ROCKETMQ),
KAFKA(2, STORE_TYPE_KAFKA),
PULSAR(3, STORE_TYPE_PULSAR),
RABBITMQ(4, STORE_TYPE_RABBITMQ),
REDIS(5, STORE_TYPE_REDIS);

@Getter
private final Integer number;
@Getter
private final String name;

public static StoreType fromNumber(Integer number) {
for (StoreType storeType : StoreType.values()) {
if (storeType.getNumber().equals(number)) {
return storeType;
}
}
return null;
}

public static StoreType fromName(String name) {
for (StoreType storeType : StoreType.values()) {
if (storeType.getName().equalsIgnoreCase(name)) {
return storeType;
}
}
return null;
}

@Override
public String toString() {
return name;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public enum HealthCheckStatus {
FAILED(0, "failed"),
PASSED(1, "passed"),
CHECKING(2, "checking"),
TIMEOUT(3, "timeout");
TIMEOUT(3, "timeout"),
NOT_CONNECTED(4, "not connected");

private final Integer number;
private final String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public class ClusterMetadata extends MetadataConfig {

private Integer status;

/**
* @see StoreType
*/
private StoreType storeType;

private String description;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@

package org.apache.eventmesh.dashboard.common.model.metadata;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class RuntimeMetadata extends MetadataConfig {

private String host;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
package org.apache.eventmesh.dashboard.common.model.remoting.acl;

public class CreateAclRequest {

//acl is included in runtime config
private String runtimeAddress;
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
import java.util.List;

public class GetGroupsResponse {

private List<GroupMetadata> groupList;
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class ResetOffsetRequest {

private String topic;

private String bootStrapServers;
private String bootstrapServers;

private Integer partitionId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@
@Data
public class GetRuntimeResponse {

private List<RuntimeMetadata> runtimeMetadata;
private List<RuntimeMetadata> runtimeMetadataList;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,5 @@
package org.apache.eventmesh.dashboard.common.model.remoting.subscription;

public class GetSubscriptionResponse {
// client name
private String clientName;

// group name
private String group;

// config content
private String subscription;
}
55 changes: 33 additions & 22 deletions eventmesh-dashboard-console/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,23 @@
</properties>

<dependencies>
<!-- Spring Boot Starter -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<!-- EventMesh Dashboard modules -->
<dependency>
<groupId>org.apache.eventmesh.dashboard.common</groupId>
<artifactId>eventmesh-dashboard-common</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.eventmesh.dashboard.core</groupId>
<artifactId>eventmesh-dashboard-core</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.eventmesh.dashboard.service</groupId>
<artifactId>eventmesh-dashboard-service</artifactId>
Expand Down Expand Up @@ -79,29 +90,29 @@
<scope>runtime</scope>
</dependency>

<!--health check client -->
<!--EventMesh SDK -->
<!--<dependency>-->
<!-- <groupId>org.apache.eventmesh</groupId>-->
<!-- <artifactId>eventmesh-sdk-java</artifactId>-->
<!-- <version>1.10.0-release</version>-->
<!-- <exclusions>-->
<!-- <exclusion>-->
<!-- <groupId>junit</groupId>-->
<!-- <artifactId>junit</artifactId>-->
<!-- </exclusion>-->
<!-- <exclusion>-->
<!-- <groupId>junit</groupId>-->
<!-- <artifactId>junit-dep</artifactId>-->
<!-- </exclusion>-->
<!-- <exclusion>-->
<!-- <groupId>org.apache.logging.log4j</groupId>-->
<!-- <artifactId>log4j-slf4j-impl</artifactId>-->
<!-- </exclusion>-->
<!-- </exclusions>-->
<!--</dependency>-->
<!-- health check client -->
<!-- EventMesh SDK -->
<!-- <dependency>-->
<!-- <groupId>org.apache.eventmesh</groupId>-->
<!-- <artifactId>eventmesh-sdk-java</artifactId>-->
<!-- <version>1.10.0-release</version>-->
<!-- <exclusions>-->
<!-- <exclusion>-->
<!-- <groupId>junit</groupId>-->
<!-- <artifactId>junit</artifactId>-->
<!-- </exclusion>-->
<!-- <exclusion>-->
<!-- <groupId>junit</groupId>-->
<!-- <artifactId>junit-dep</artifactId>-->
<!-- </exclusion>-->
<!-- <exclusion>-->
<!-- <groupId>org.apache.logging.log4j</groupId>-->
<!-- <artifactId>log4j-slf4j-impl</artifactId>-->
<!-- </exclusion>-->
<!-- </exclusions>-->
<!-- </dependency>-->

<!--health check client end-->
<!-- health check client end -->
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

/**
* This annotation is used to mark the type of health check service implement.
* @see org.apache.eventmesh.dashboard.console.enums.health.HealthCheckType
* @see org.apache.eventmesh.dashboard.common.enums.health.HealthCheckType
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@

package org.apache.eventmesh.dashboard.console.function.health.check.impl.storage.rocketmq4;

import static org.apache.eventmesh.dashboard.common.constant.health.HealthCheckTypeConstant.HEALTH_CHECK_SUBTYPE_ROCKETMQ_BROKER;
import static org.apache.eventmesh.dashboard.common.constant.health.HealthCheckTypeConstant.HEALTH_CHECK_TYPE_STORAGE;

import org.apache.eventmesh.dashboard.console.function.health.annotation.HealthCheckType;
import org.apache.eventmesh.dashboard.console.function.health.callback.HealthCheckCallback;
import org.apache.eventmesh.dashboard.console.function.health.check.AbstractHealthCheckService;
import org.apache.eventmesh.dashboard.console.function.health.check.config.HealthCheckObjectConfig;
Expand All @@ -36,7 +32,6 @@
import lombok.extern.slf4j.Slf4j;

@Slf4j
@HealthCheckType(type = HEALTH_CHECK_TYPE_STORAGE, subType = HEALTH_CHECK_SUBTYPE_ROCKETMQ_BROKER)
public class Rocketmq4BrokerCheck extends AbstractHealthCheckService {

private RemotingClient remotingClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import lombok.extern.slf4j.Slf4j;

@Slf4j
@HealthCheckType(type = HealthCheckTypeConstant.HEALTH_CHECK_TYPE_STORAGE, subType = HealthCheckTypeConstant.HEALTH_CHECK_SUBTYPE_ROCKETMQ_NAMESERVER)
@HealthCheckType(type = HealthCheckTypeConstant.HEALTH_CHECK_TYPE_STORAGE, subType = HealthCheckTypeConstant.HEALTH_CHECK_SUBTYPE_ROCKETMQ)
public class Rocketmq4NameServerCheck extends AbstractHealthCheckService {

private RemotingClient remotingClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@

import static org.apache.rocketmq.client.producer.SendStatus.SEND_OK;

import org.apache.eventmesh.dashboard.common.constant.health.HealthCheckTypeConstant;
import org.apache.eventmesh.dashboard.common.constant.health.HealthConstant;
import org.apache.eventmesh.dashboard.console.function.health.annotation.HealthCheckType;
import org.apache.eventmesh.dashboard.console.function.health.callback.HealthCheckCallback;
import org.apache.eventmesh.dashboard.console.function.health.check.AbstractHealthCheckService;
import org.apache.eventmesh.dashboard.console.function.health.check.config.HealthCheckObjectConfig;
Expand Down Expand Up @@ -57,7 +55,6 @@
import lombok.extern.slf4j.Slf4j;

@Slf4j
@HealthCheckType(type = HealthCheckTypeConstant.HEALTH_CHECK_TYPE_STORAGE, subType = HealthCheckTypeConstant.HEALTH_CHECK_SUBTYPE_ROCKETMQ_TOPIC)
public class Rocketmq4TopicCheck extends AbstractHealthCheckService {

private RemotingClient remotingClient;
Expand Down
Loading

0 comments on commit 6f268a0

Please sign in to comment.