Skip to content

Commit

Permalink
fix: resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Lambert-Rao committed Apr 7, 2024
1 parent 1c3249a commit 03a6a00
Show file tree
Hide file tree
Showing 38 changed files with 132 additions and 98 deletions.
1 change: 0 additions & 1 deletion eventmesh-dashboard-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<scope>provided</scope>
</dependency>

<!-- Utility -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@

package org.apache.eventmesh.dashboard.console.entity.cluster;

import org.apache.eventmesh.dashboard.common.enums.StoreType;
import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity;

import java.sql.Timestamp;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
Expand All @@ -33,8 +30,6 @@
@Builder
public class ClusterEntity extends BaseEntity {

private Long id;

private String name;

private String registryAddress;
Expand All @@ -57,9 +52,5 @@ public class ClusterEntity extends BaseEntity {

private Integer status;

private Timestamp createTime;

private Timestamp updateTime;

private Integer storeType;
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import io.swagger.v3.oas.annotations.media.Schema;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
Expand All @@ -32,6 +33,7 @@
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Builder
public class ConnectorEntity extends BaseEntity {

private static final long serialVersionUID = -8226303660232951326L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ public class StoreEntity extends BaseEntity {

private Long clusterId;

private Integer storeId;

/**
* @see org.apache.eventmesh.dashboard.common.enums.StoreType
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,19 @@
import lombok.Setter;

public class CheckResultCache {

@Getter
private static final CheckResultCache INSTANCE = new CheckResultCache();

private static final HashMap<String, HashMap<Long, CheckResult>> cacheMap = new HashMap<>();
private final HashMap<String, HashMap<Long, CheckResult>> cacheMap = new HashMap<>();

public static Integer getLastHealthyCheckResult(String type, Long typeId) {
public Integer getLastHealthyCheckResult(String type, Long typeId) {
if (!Objects.isNull(cacheMap.get(type)) && !Objects.isNull(cacheMap.get(type).get(typeId))) {
return cacheMap.get(type).get(typeId).getStatus().getNumber();
}
return HealthCheckStatus.CHECKING.getNumber();
}

private CheckResultCache() {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,21 @@

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;
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.CreateRocketmqConfig;

import org.apache.rocketmq.common.protocol.RequestCode;
import org.apache.rocketmq.remoting.InvokeCallback;
import org.apache.rocketmq.remoting.RemotingClient;
import org.apache.rocketmq.remoting.netty.NettyClientConfig;
import org.apache.rocketmq.remoting.netty.NettyRemotingClient;
import org.apache.rocketmq.remoting.netty.ResponseFuture;
import org.apache.rocketmq.remoting.protocol.RemotingCommand;

import java.util.Objects;

import lombok.extern.slf4j.Slf4j;

@Slf4j
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@
import org.apache.rocketmq.remoting.netty.ResponseFuture;
import org.apache.rocketmq.remoting.protocol.RemotingCommand;

import java.util.Objects;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@HealthCheckType(type = HealthCheckTypeConstant.HEALTH_CHECK_TYPE_STORAGE, subType = HealthCheckTypeConstant.HEALTH_CHECK_SUBTYPE_ROCKETMQ)
@HealthCheckType(HealthCheckTypeConstant.HEALTH_CHECK_TYPE_STORAGE)
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
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ public class ConnectionMetadataHandlerToDbImpl implements MetadataHandler<Connec
@Override
public void addMetadata(ConnectionMetadata meta) {
if (Objects.equals(meta.getSinkType(), "connector")) {
List<ConnectorEntity> sink = connectorDataService.selectByHostPort(meta.getSinkHost(), meta.getSinkPort());
ConnectorEntity query = ConnectorEntity.builder()
.host(meta.getSinkHost())
.port(meta.getSinkPort())
.build();
List<ConnectorEntity> sink = connectorDataService.selectByHostPort(query);
if (sink.size() == 1) {
meta.setSinkId(sink.get(0).getId());
} else if (sink.isEmpty()) {
Expand Down Expand Up @@ -97,7 +101,11 @@ public void addMetadata(ConnectionMetadata meta) {
}

if (Objects.equals(meta.getSourceType(), "connector")) {
List<ConnectorEntity> source = connectorDataService.selectByHostPort(meta.getSourceHost(), meta.getSourcePort());
ConnectorEntity query = ConnectorEntity.builder()
.host(meta.getSourceHost())
.port(meta.getSourcePort())
.build();
List<ConnectorEntity> source = connectorDataService.selectByHostPort(query);
if (source.size() == 1) {
meta.setSourceId(source.get(0).getId());
} else if (source.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ public void addMetadata(List<RegistryMetadata> meta) {

@Override
public void deleteMetadata(RegistryMetadata meta) {
registryDataService.deActive(converter.convert(meta));
registryDataService.deactivate(converter.convert(meta));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,20 @@ public void addMetadata(RuntimeMetadata meta) {
ClusterEntity cluster = ClusterCache.getINSTANCE().getClusterByRegistryAddress(meta.getClusterRegistryAddress());
if (Objects.isNull(cluster)) {
log.info("new cluster detected syncing runtime, adding cluster to db, cluster:{}", meta.getClusterName());
ClusterEntity clusterEntity = new ClusterEntity(meta.getClusterName(), meta.getRegistryAddress(), "", "", "", "", "", "", 0, 0, 1,
null, null, 0);
ClusterEntity clusterEntity = new ClusterEntity();
clusterEntity.setId(0L);
clusterEntity.setName(meta.getClusterName());
clusterEntity.setRegistryAddress(meta.getRegistryAddress());
clusterEntity.setBootstrapServers("");
clusterEntity.setEventmeshVersion("");
clusterEntity.setClientProperties("");
clusterEntity.setJmxProperties("");
clusterEntity.setRegProperties("");
clusterEntity.setDescription("");
clusterEntity.setAuthType(0);
clusterEntity.setRunState(0);
clusterEntity.setStoreType(0);

clusterService.addCluster(clusterEntity);
} else {
cluster.setName(meta.getClusterName());
Expand All @@ -68,7 +80,7 @@ public void addMetadata(RuntimeMetadata meta) {

@Override
public void deleteMetadata(RuntimeMetadata meta) {
runtimeService.deActive(converter.convert(meta));
runtimeService.deactivate(converter.convert(meta));
RuntimeCache.getInstance().deleteRuntime(converter.convert(meta));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ public void addMetadata(TopicMetadata meta) {

@Override
public void deleteMetadata(TopicMetadata meta) {
topicService.deleteTopic(null, meta.getTopicName());
topicService.deleteTopic(null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public class TopicEntity2MetadataConverter implements Converter<TopicEntity, Top
public TopicMetadata convert(TopicEntity source) {
TopicMetadata topicMetadata = new TopicMetadata();
topicMetadata.setTopicName(source.getTopicName());
topicMetadata.setRuntimeId(source.getRuntimeId());
topicMetadata.setStorageId(source.getStorageId());
topicMetadata.setRetentionMs(source.getRetentionMs());
topicMetadata.setType(source.getType());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public TopicEntity convert(TopicMetadata source) {
TopicEntity topicEntity = new TopicEntity();
topicEntity.setClusterId(source.getClusterId());
topicEntity.setTopicName(source.getTopicName());
topicEntity.setRuntimeId(source.getRuntimeId());
topicEntity.setStorageId(source.getStorageId());
topicEntity.setRetentionMs(source.getRetentionMs());
topicEntity.setType(source.getType());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
Expand Down Expand Up @@ -70,5 +69,5 @@ public interface ClusterMapper {
void updateClusterById(ClusterEntity cluster);

@Update("UPDATE cluster SET status=0 WHERE id=#{id}")
void deActive(ClusterEntity clusterEntity);
void deactivate(ClusterEntity clusterEntity);
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import org.apache.eventmesh.dashboard.console.entity.meta.MetaEntity;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
Expand Down Expand Up @@ -59,5 +58,5 @@ public interface MetaMapper {
Long insert(MetaEntity metaEntity);

@Update("UPDATE meta SET status = 0 WHERE id = #{id}")
void deActive(MetaEntity metaEntity);
void deactivate(MetaEntity metaEntity);
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@

import org.apache.eventmesh.dashboard.console.entity.runtime.RuntimeEntity;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

Expand Down Expand Up @@ -59,9 +59,6 @@ public interface RuntimeMapper {
@Select("SELECT * FROM runtime WHERE cluster_id=#{clusterId} AND status=1")
List<RuntimeEntity> selectRuntimeByCluster(RuntimeEntity runtimeEntity);

@Select("SELECT * FROM runtime WHERE host = #{host} and port = #{port} and status = 1")
List<RuntimeEntity> selectByHostPort(RuntimeEntity runtimeEntity);

@Select({
"<script>",
"SELECT * FROM runtime",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@

import org.apache.eventmesh.dashboard.console.entity.topic.TopicEntity;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

Expand All @@ -38,9 +38,6 @@ public interface TopicMapper {
@Select("SELECT * FROM topic WHERE status=1")
List<TopicEntity> selectAll();

@Select("SELECT * FROM topic WHERE cluster_id=#{clusterId} AND status=1")
List<TopicEntity> selectAllByClusterId(TopicEntity topicEntity);

@Insert({
"<script>",
"INSERT INTO topic (cluster_id, topic_name, storage_id, retention_ms, type, description, create_progress) VALUES ",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public List<ClientEntity> selectAll() {

@Override
public void deActive(ClientEntity clientEntity) {
clientMapper.deActive(clientEntity);
clientMapper.deactivate(clientEntity);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
package org.apache.eventmesh.dashboard.console.service.cluster;

import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
import org.apache.eventmesh.dashboard.console.modle.vo.cluster.GetClusterBaseMessageVO;
import org.apache.eventmesh.dashboard.console.modle.vo.cluster.ResourceNumVO;

import java.util.List;

Expand All @@ -38,7 +40,7 @@ public interface ClusterService {

List<ClusterEntity> selectAllCluster();

ClusterEntity selectClusterById(Long cluster);
ClusterEntity selectClusterById(ClusterEntity cluster);

void updateClusterById(ClusterEntity cluster);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,19 @@

package org.apache.eventmesh.dashboard.console.service.cluster.impl;

import org.apache.eventmesh.dashboard.console.cache.ClusterCache;
import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity;
import org.apache.eventmesh.dashboard.console.entity.connection.ConnectionEntity;
import org.apache.eventmesh.dashboard.console.entity.group.GroupEntity;
import org.apache.eventmesh.dashboard.console.entity.runtime.RuntimeEntity;
import org.apache.eventmesh.dashboard.console.entity.topic.TopicEntity;
import org.apache.eventmesh.dashboard.console.mapper.cluster.ClusterMapper;
import org.apache.eventmesh.dashboard.console.mapper.connection.ConnectionMapper;
import org.apache.eventmesh.dashboard.console.mapper.group.OprGroupMapper;
import org.apache.eventmesh.dashboard.console.mapper.runtime.RuntimeMapper;
import org.apache.eventmesh.dashboard.console.mapper.topic.TopicMapper;
import org.apache.eventmesh.dashboard.console.modle.vo.cluster.GetClusterBaseMessageVO;
import org.apache.eventmesh.dashboard.console.modle.vo.cluster.ResourceNumVO;
import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService;

import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ public interface ConnectionDataService {

List<ConnectionListVO> getConnectionToFrontByCluster(Long clusterId, GetConnectionListDTO getConnectionListDTO);

void replaceAllConnections(List<ConnectionEntity> connectionEntityList);


List<ConfigEntity> getConnectorConfigsByClassAndVersion(String classType, String version);

void insert(ConnectionEntity connectionEntity);
Long insert(ConnectionEntity connectionEntity);
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,9 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


@Service
public class ConnectionDataServiceDatabaseImpl implements ConnectionDataService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ public List<ConnectorEntity> selectConnectorByCluster(Long clusterId) {
}

@Override
public List<ConnectorEntity> selectByHostPort(String host, Integer port) {
ConnectorEntity connectorEntity = new ConnectorEntity();
connectorEntity.setHost(host);
connectorEntity.setPort(port);
public List<ConnectorEntity> selectByHostPort(ConnectorEntity connectorEntity) {
return connectorMapper.selectByHostAndPort(connectorEntity);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.eventmesh.dashboard.console.service.health;

import org.apache.eventmesh.dashboard.console.entity.health.HealthCheckResultEntity;
import org.apache.eventmesh.dashboard.console.modle.vo.health.InstanceLiveProportionVo;

import java.sql.Timestamp;
import java.util.List;
Expand Down
Loading

0 comments on commit 03a6a00

Please sign in to comment.