mirror of
https://github.com/PowerJob/PowerJob.git
synced 2025-07-17 00:00:04 +08:00
why I am so stupid? How can I find the way to ensure Scheduler HA?
This commit is contained in:
parent
26206a90cf
commit
1267b3a34f
@ -13,5 +13,60 @@
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<swagger.version>2.9.2</swagger.version>
|
||||
<springboot.version>2.2.6.RELEASE</springboot.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- SpringBoot -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<version>${springboot.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- swagger2 -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>${swagger.version}</version>
|
||||
</dependency>
|
||||
<!-- swagger2 ui -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<!-- SpringBoot专用的打包插件 -->
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${springboot.version}</version>
|
||||
<configuration>
|
||||
<mainClass>com.github.kfcfans.oms.server.OhMyApplication</mainClass>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal><!--可以把依赖的包都打包到生成的Jar包中-->
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
@ -0,0 +1,19 @@
|
||||
package com.github.kfcfans.oms.server;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* SpringBoot 启动入口
|
||||
*
|
||||
* @author tjq
|
||||
* @since 2020/3/29
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class OhMyApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(OhMyApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.github.kfcfans.oms.server.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
import static springfox.documentation.builders.PathSelectors.any;
|
||||
|
||||
/**
|
||||
* Swagger UI 配置
|
||||
*
|
||||
* @author tjq
|
||||
* @since 2020/3/29
|
||||
*/
|
||||
@Configuration
|
||||
@EnableSwagger2
|
||||
public class SwaggerConfig {
|
||||
|
||||
@Bean
|
||||
public Docket createRestApi() {
|
||||
// apiInfo()用来创建该Api的基本信息(这些基本信息会展现在文档页面中
|
||||
ApiInfo apiInfo = new ApiInfoBuilder()
|
||||
.title("OhMyScheduler")
|
||||
.description("Distributed scheduling and computing framework.")
|
||||
.license("GPL")
|
||||
.termsOfServiceUrl("https://github.com/KFCFans/OhMyScheduler")
|
||||
.version("DEVELOP-VERSION")
|
||||
.build();
|
||||
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.apiInfo(apiInfo)
|
||||
// select()函数返回一个ApiSelectorBuilder实例
|
||||
.select()
|
||||
// 决定了暴露哪些接口给 Swagger
|
||||
.paths(any())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.github.kfcfans.oms.server.model;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 数据库实体类基类
|
||||
*
|
||||
* @author tjq
|
||||
* @since 2020/3/29
|
||||
*/
|
||||
public abstract class BaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
private Date gmtCreate;
|
||||
private Date gmtModified;
|
||||
|
||||
private String attribute;
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.github.kfcfans.oms.server.model;
|
||||
|
||||
/**
|
||||
* 分组信息表
|
||||
*
|
||||
* @author tjq
|
||||
* @since 2020/3/29
|
||||
*/
|
||||
public class GroupInfoDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 分组名称
|
||||
*/
|
||||
private String groupName;
|
||||
/**
|
||||
* 分组描述
|
||||
*/
|
||||
private String groupDescription;
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.github.kfcfans.oms.server.model;
|
||||
|
||||
/**
|
||||
* 任务信息表
|
||||
*
|
||||
* @author tjq
|
||||
* @since 2020/3/29
|
||||
*/
|
||||
public class JobInfoDO extends BaseDO {
|
||||
|
||||
|
||||
/* ************************** 任务基本信息 ************************** */
|
||||
// 任务名称
|
||||
private String jobName;
|
||||
// 任务描述
|
||||
private String jobDescription;
|
||||
// 任务分组名称
|
||||
private String groupName;
|
||||
|
||||
/* ************************** 定时参数 ************************** */
|
||||
// 时间表达式类型(CRON/API/FIX_RATE/FIX_DELAY)
|
||||
private int timeExpressionType;
|
||||
// 时间表达式,CRON/NULL/LONG/LONG
|
||||
private String timeExpression;
|
||||
|
||||
|
||||
/* ************************** 执行方式 ************************** */
|
||||
// 执行类型,单机/广播/MR
|
||||
private int executeType;
|
||||
// 执行器类型,Java/Shell
|
||||
private int processorType;
|
||||
// 执行器信息
|
||||
private String processorInfo;
|
||||
|
||||
/* ************************** 运行时配置 ************************** */
|
||||
// 并发度,同时执行的线程数量
|
||||
private int concurrency;
|
||||
// 任务整体超时时间
|
||||
private long instanceTimeLimit;
|
||||
// 任务的每一个Task超时时间
|
||||
private long taskTimeLimit;
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.github.kfcfans.oms.server.model;
|
||||
|
||||
/**
|
||||
* 任务运行日志表
|
||||
*
|
||||
* @author tjq
|
||||
* @since 2020/3/30
|
||||
*/
|
||||
public class JobLogDO extends BaseDO {
|
||||
|
||||
// 任务ID
|
||||
private Long jobId;
|
||||
// 任务实例ID
|
||||
private String instanceId;
|
||||
// 任务状态 运行中/成功/失败...
|
||||
private int status;
|
||||
// 执行结果
|
||||
private String result;
|
||||
// 耗时
|
||||
private Long usedTime;
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.github.kfcfans.oms.server.model;
|
||||
|
||||
/**
|
||||
* 注册信息表,用于服务发现
|
||||
*
|
||||
* @author tjq
|
||||
* @since 2020/3/30
|
||||
*/
|
||||
public class RegisterInfoDO extends BaseDO {
|
||||
|
||||
private String appName;
|
||||
private String currentServerAddress;
|
||||
private String lastServerAddress;
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
# server port config
|
||||
server.port=7700
|
Loading…
x
Reference in New Issue
Block a user