Skip to content

Commit

Permalink
more db
Browse files Browse the repository at this point in the history
  • Loading branch information
sodaRyCN committed May 14, 2024
1 parent c21ac4d commit 2302346
Show file tree
Hide file tree
Showing 50 changed files with 880 additions and 391 deletions.
1 change: 1 addition & 0 deletions eventmesh-admin-server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dependencies {
implementation project(":eventmesh-common")
implementation project(":eventmesh-registry:eventmesh-registry-api")
implementation project(":eventmesh-registry:eventmesh-registry-nacos")
implementation project(':eventmesh-openconnect:eventmesh-openconnect-offsetmgmt-plugin:eventmesh-openconnect-offsetmgmt-api')
implementation "com.alibaba.nacos:nacos-client"
implementation ("org.springframework.boot:spring-boot-starter-web") {
exclude group: "org.springframework.boot", module: "spring-boot-starter-tomcat"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.apache.eventmesh.admin.server.web;

import com.apache.eventmesh.admin.server.AdminServerException;
import com.apache.eventmesh.admin.server.web.handler.BaseRequestHandler;
import com.apache.eventmesh.admin.server.web.handler.RequestHandlerFactory;
import com.apache.eventmesh.admin.server.web.handler.request.BaseRequestHandler;
import com.apache.eventmesh.admin.server.web.handler.request.impl.RequestHandlerFactory;
import io.grpc.stub.ServerCallStreamObserver;
import io.grpc.stub.StreamObserver;
import lombok.extern.slf4j.Slf4j;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public void destroy() {
server.shutdown();
if(!server.awaitTermination(30, TimeUnit.SECONDS)) {
log.warn("[{}] server don't graceful stop in 30s, it will shutdown now", this.getClass().getSimpleName());
server.shutdownNow();
}
}
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.apache.eventmesh.admin.server.web.db;

import lombok.extern.slf4j.Slf4j;
import org.apache.eventmesh.common.EventMeshThreadFactory;
import org.springframework.stereotype.Component;

import javax.annotation.PreDestroy;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

@Component
@Slf4j
public class DBThreadPool {
private final ThreadPoolExecutor executor =
new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors() * 2,
Runtime.getRuntime().availableProcessors() * 2, 0L, TimeUnit.SECONDS,
new LinkedBlockingQueue<>(1000), new EventMeshThreadFactory("admin-server-db"),
new ThreadPoolExecutor.DiscardOldestPolicy());
@PreDestroy
private void destroy() {
if (!executor.isShutdown()) {
try {
executor.shutdown();
if (!executor.awaitTermination(30, TimeUnit.SECONDS)) {
log.info("wait heart beat handler thread pool shutdown timeout, it will shutdown immediately");
executor.shutdownNow();
}
} catch (InterruptedException e) {
log.warn("wait heart beat handler thread pool shutdown fail");
}
}
}

public ThreadPoolExecutor getExecutors() {
return executor;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ public class EventMeshJobInfo implements Serializable {

private Integer jobType;

private Integer position;

private Integer createUid;

private Integer updateUid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
import java.util.Date;

/**
* @TableName event_mesh_job_position
* @TableName event_mesh_mysql_position
*/
@TableName(value ="event_mesh_job_position")
@TableName(value ="event_mesh_mysql_position")
@Data
public class EventMeshJobPosition implements Serializable {
public class EventMeshMysqlPosition implements Serializable {
@TableId(type = IdType.AUTO)
private Integer id;

Expand All @@ -23,6 +23,10 @@ public class EventMeshJobPosition implements Serializable {

private Long position;

private Long timestamp;

private String journalName;

private Date createTime;

private Date updateTime;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.apache.eventmesh.admin.server.web.db.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
* @TableName event_mesh_position_reporter_history
*/
@TableName(value ="event_mesh_position_reporter_history")
@Data
public class EventMeshPositionReporterHistory implements Serializable {
@TableId(type = IdType.AUTO)
private Long id;

private Integer job;

private String record;

private String address;

private Date createTime;

private static final long serialVersionUID = 1L;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
* @TableName event_mesh_heartbeat
* @TableName event_mesh_runtime_heartbeat
*/
@TableName(value ="event_mesh_heartbeat")
@TableName(value ="event_mesh_runtime_heartbeat")
@Data
public class EventMeshHeartbeat implements Serializable {
public class EventMeshRuntimeHeartbeat implements Serializable {
@TableId(type = IdType.AUTO)
private Integer id;
private Long id;

private String adminAddr;

Expand All @@ -24,7 +25,9 @@ public class EventMeshHeartbeat implements Serializable {

private String reportTime;

private String updateTime;
private Date updateTime;

private Date createTime;

private static final long serialVersionUID = 1L;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.apache.eventmesh.admin.server.web.db.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
* @TableName event_mesh_runtime_history
*/
@TableName(value ="event_mesh_runtime_history")
@Data
public class EventMeshRuntimeHistory implements Serializable {
@TableId(type = IdType.AUTO)
private Long id;

private Integer job;

private String address;

private Date createTime;

private static final long serialVersionUID = 1L;
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package com.apache.eventmesh.admin.server.web.db.mapper;

import com.apache.eventmesh.admin.server.web.db.entity.EventMeshDataSource;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

/**
* @author sodafang
* @description 针对表【event_mesh_data_source】的数据库操作Mapper
* @createDate 2024-05-09 15:52:49
* @Entity com.apache.eventmesh.admin.server.web.db.entity.EventMeshDataSource
*/
@Mapper
public interface EventMeshDataSourceMapper extends BaseMapper<EventMeshDataSource> {

}



package com.apache.eventmesh.admin.server.web.db.mapper;

import com.apache.eventmesh.admin.server.web.db.entity.EventMeshDataSource;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

/**
* @author sodafang
* @description 针对表【event_mesh_data_source】的数据库操作Mapper
* @createDate 2024-05-09 15:52:49
* @Entity com.apache.eventmesh.admin.server.web.db.entity.EventMeshDataSource
*/
@Mapper
public interface EventMeshDataSourceMapper extends BaseMapper<EventMeshDataSource> {

}




Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package com.apache.eventmesh.admin.server.web.db.mapper;

import com.apache.eventmesh.admin.server.web.db.entity.EventMeshJobInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

/**
* @author sodafang
* @description 针对表【event_mesh_job_info】的数据库操作Mapper
* @createDate 2024-05-09 15:51:45
* @Entity com.apache.eventmesh.admin.server.web.db.entity.EventMeshJobInfo
*/
@Mapper
public interface EventMeshJobInfoMapper extends BaseMapper<EventMeshJobInfo> {

}



package com.apache.eventmesh.admin.server.web.db.mapper;

import com.apache.eventmesh.admin.server.web.db.entity.EventMeshJobInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

/**
* @author sodafang
* @description 针对表【event_mesh_job_info】的数据库操作Mapper
* @createDate 2024-05-09 15:51:45
* @Entity com.apache.eventmesh.admin.server.web.db.entity.EventMeshJobInfo
*/
@Mapper
public interface EventMeshJobInfoMapper extends BaseMapper<EventMeshJobInfo> {

}




Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package com.apache.eventmesh.admin.server.web.db.mapper;

import com.apache.eventmesh.admin.server.web.db.entity.EventMeshHeartbeat;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

/**
* @author sodafang
* @description 针对表【event_mesh_heartbeat】的数据库操作Mapper
* @createDate 2024-05-10 16:05:00
* @Entity com.apache.eventmesh.admin.server.web.db.entity.EventMeshHeartbeat
*/
@Mapper
public interface EventMeshHeartbeatMapper extends BaseMapper<EventMeshHeartbeat> {

}



package com.apache.eventmesh.admin.server.web.db.mapper;

import com.apache.eventmesh.admin.server.web.db.entity.EventMeshMysqlPosition;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

/**
* @author sodafang
* @description 针对表【event_mesh_mysql_position】的数据库操作Mapper
* @createDate 2024-05-14 17:15:03
* @Entity com.apache.eventmesh.admin.server.web.db.entity.EventMeshMysqlPosition
*/
@Mapper
public interface EventMeshMysqlPositionMapper extends BaseMapper<EventMeshMysqlPosition> {

}




Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.apache.eventmesh.admin.server.web.db.mapper;

import com.apache.eventmesh.admin.server.web.db.entity.EventMeshPositionReporterHistory;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

/**
* @author sodafang
* @description 针对表【event_mesh_position_reporter_history(记录position上报者变更时,老记录)】的数据库操作Mapper
* @createDate 2024-05-14 17:15:03
* @Entity com.apache.eventmesh.admin.server.web.db.entity.EventMeshPositionReporterHistory
*/
@Mapper
public interface EventMeshPositionReporterHistoryMapper extends BaseMapper<EventMeshPositionReporterHistory> {

}




Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package com.apache.eventmesh.admin.server.web.db.mapper;

import com.apache.eventmesh.admin.server.web.db.entity.EventMeshJobPosition;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

/**
* @author sodafang
* @description 针对表【event_mesh_job_position】的数据库操作Mapper
* @createDate 2024-05-09 09:33:01
* @Entity com.apache.eventmesh.admin.server.web.db.entity.EventMeshJobPosition
*/
@Mapper
public interface EventMeshJobPositionMapper extends BaseMapper<EventMeshJobPosition> {

}



package com.apache.eventmesh.admin.server.web.db.mapper;

import com.apache.eventmesh.admin.server.web.db.entity.EventMeshRuntimeHeartbeat;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

/**
* @author sodafang
* @description 针对表【event_mesh_runtime_heartbeat】的数据库操作Mapper
* @createDate 2024-05-14 17:15:03
* @Entity com.apache.eventmesh.admin.server.web.db.entity.EventMeshRuntimeHeartbeat
*/
@Mapper
public interface EventMeshRuntimeHeartbeatMapper extends BaseMapper<EventMeshRuntimeHeartbeat> {

}




Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.apache.eventmesh.admin.server.web.db.mapper;

import com.apache.eventmesh.admin.server.web.db.entity.EventMeshRuntimeHistory;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

/**
* @author sodafang
* @description 针对表【event_mesh_runtime_history(记录runtime上运行任务的变更)】的数据库操作Mapper
* @createDate 2024-05-14 17:15:03
* @Entity com.apache.eventmesh.admin.server.web.db.entity.EventMeshRuntimeHistory
*/
@Mapper
public interface EventMeshRuntimeHistoryMapper extends BaseMapper<EventMeshRuntimeHistory> {

}




Loading

0 comments on commit 2302346

Please sign in to comment.