-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SnailJob(灵活,可靠和快速的分布式任务重试和分布式任务调度平台)
- Loading branch information
Showing
51 changed files
with
8,843 additions
and
18 deletions.
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
continew-admin-extension/continew-admin-job-server/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns="http://maven.apache.org/POM/4.0.0" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>top.continew</groupId> | ||
<artifactId>continew-admin-extension</artifactId> | ||
<version>${revision}</version> | ||
</parent> | ||
|
||
<artifactId>continew-admin-job-server</artifactId> | ||
<description>任务调度服务模块</description> | ||
|
||
<properties> | ||
<!-- SnailJob 服务端 --> | ||
<snail-job.version>1.1.0-beta1</snail-job.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<!-- SnailJob(灵活,可靠和快速的分布式任务重试和分布式任务调度平台) --> | ||
<dependency> | ||
<groupId>com.aizuda</groupId> | ||
<artifactId>snail-job-server-starter</artifactId> | ||
<version>${snail-job.version}</version> | ||
</dependency> | ||
|
||
<!-- MyBatis Plus(MyBatis 的增强工具,在 MyBatis 的基础上只做增强不做改变,简化开发、提高效率) --> | ||
<dependency> | ||
<groupId>com.baomidou</groupId> | ||
<artifactId>mybatis-plus-spring-boot3-starter</artifactId> | ||
</dependency> | ||
|
||
<!-- Dynamic Datasource(基于 Spring Boot 的快速集成多数据源的启动器) --> | ||
<dependency> | ||
<groupId>com.baomidou</groupId> | ||
<artifactId>dynamic-datasource-spring-boot3-starter</artifactId> | ||
</dependency> | ||
|
||
<!-- Liquibase(用于管理数据库版本,跟踪、管理和应用数据库变化) --> | ||
<dependency> | ||
<groupId>org.liquibase</groupId> | ||
<artifactId>liquibase-core</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<!-- 设置构建的 jar 包名 --> | ||
<finalName>${project.artifactId}</finalName> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>repackage</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
34 changes: 34 additions & 0 deletions
34
...ob-server/src/main/java/top/continew/admin/extension/job/ContinewAdminJobApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. | ||
* | ||
* Licensed 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 top.continew.admin.extension.job; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
/** | ||
* 任务调度服务启动程序 | ||
* | ||
* @author KAI | ||
* @since 2024/6/25 22:24 | ||
*/ | ||
@SpringBootApplication | ||
public class ContinewAdminJobApplication { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(com.aizuda.snailjob.server.SnailJobServerApplication.class, args); | ||
} | ||
} |
69 changes: 69 additions & 0 deletions
69
...w-admin-extension/continew-admin-job-server/src/main/resources/config/application-dev.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
server: | ||
port: 8001 | ||
|
||
--- ### 数据源配置 | ||
spring.datasource: | ||
type: com.zaxxer.hikari.HikariDataSource | ||
## 动态数据源配置(可配多主多从:m1、s1...;纯粹多库:mysql、oracle...;混合配置:m1、s1、oracle...) | ||
dynamic: | ||
# 设置默认的数据源或者数据源组(默认:master) | ||
primary: master | ||
# 严格匹配数据源(true:未匹配到指定数据源时抛异常;false:使用默认数据源;默认 false) | ||
strict: false | ||
datasource: | ||
# 主库配置(可配多个,构成多主) | ||
master: | ||
url: jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:continew_admin_job}?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true&autoReconnect=true&maxReconnects=10&failOverReadOnly=false&allowPublicKeyRetrieval=true | ||
username: ${DB_USER:root} | ||
password: ${DB_PWD:123456} | ||
driver-class-name: com.mysql.cj.jdbc.Driver | ||
type: ${spring.datasource.type} | ||
hikari: | ||
# 最大连接数量(默认 10,根据实际环境调整) | ||
# 注意:当连接达到上限,并且没有空闲连接可用时,获取连接将在超时前阻塞最多 connectionTimeout 毫秒 | ||
max-pool-size: 20 | ||
# 获取连接超时时间(默认 30000 毫秒,30 秒) | ||
connection-timeout: 30000 | ||
# 空闲连接最大存活时间(默认 600000 毫秒,10 分钟) | ||
idle-timeout: 600000 | ||
# 保持连接活动的频率,以防止它被数据库或网络基础设施超时。该值必须小于 maxLifetime(默认 0,禁用) | ||
keepaliveTime: 30000 | ||
# 连接最大生存时间(默认 1800000 毫秒,30 分钟) | ||
max-lifetime: 1800000 | ||
## Liquibase 配置 | ||
spring.liquibase: | ||
# 是否启用 | ||
enabled: true | ||
# 配置文件路径 | ||
change-log: classpath:/db/changelogs/db.changelog-master.yaml | ||
|
||
--- ### Snail Job 服务端配置 | ||
snail-job: | ||
# Netty 端口 | ||
netty-port: 1788 | ||
# 合并日志默认保存天数 | ||
merge-Log-days: 1 | ||
# 合并日志默认的条数 | ||
merge-Log-num: 500 | ||
# 配置日志保存时间(单位:天) | ||
log-storage: 90 | ||
# 配置每批次拉取重试数据的大小 | ||
retry-pull-page-size: 100 | ||
# 配置一个客户端每秒最多接收的重试数量指令 | ||
limiter: 10 | ||
# 配置号段模式下的步长 | ||
step: 100 | ||
# bucket 的总数量 | ||
bucket-total: 128 | ||
# Dashboard 任务容错天数 | ||
summary-day: 7 | ||
# 配置负载均衡周期时间 | ||
load-balance-cycle-time: 10 | ||
## 回调配置 | ||
callback: | ||
# 回调 uniqueId 前缀 | ||
prefix: CB | ||
# 配置回调的最大执行次数 | ||
max-count: 288 | ||
# 配置回调触发的间隔时间 | ||
trigger-interval: 900 |
69 changes: 69 additions & 0 deletions
69
...-admin-extension/continew-admin-job-server/src/main/resources/config/application-prod.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
server: | ||
port: 18001 | ||
|
||
--- ### 数据源配置 | ||
spring.datasource: | ||
type: com.zaxxer.hikari.HikariDataSource | ||
## 动态数据源配置(可配多主多从:m1、s1...;纯粹多库:mysql、oracle...;混合配置:m1、s1、oracle...) | ||
dynamic: | ||
# 设置默认的数据源或者数据源组(默认:master) | ||
primary: master | ||
# 严格匹配数据源(true:未匹配到指定数据源时抛异常;false:使用默认数据源;默认 false) | ||
strict: false | ||
datasource: | ||
# 主库配置(可配多个,构成多主) | ||
master: | ||
url: jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:continew_admin_job}?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true&autoReconnect=true&maxReconnects=10&failOverReadOnly=false | ||
username: ${DB_USER:root} | ||
password: ${DB_PWD:123456} | ||
driver-class-name: com.mysql.cj.jdbc.Driver | ||
type: ${spring.datasource.type} | ||
hikari: | ||
# 最大连接数量(默认 10,根据实际环境调整) | ||
# 注意:当连接达到上限,并且没有空闲连接可用时,获取连接将在超时前阻塞最多 connectionTimeout 毫秒 | ||
max-pool-size: 20 | ||
# 获取连接超时时间(默认 30000 毫秒,30 秒) | ||
connection-timeout: 30000 | ||
# 空闲连接最大存活时间(默认 600000 毫秒,10 分钟) | ||
idle-timeout: 600000 | ||
# 保持连接活动的频率,以防止它被数据库或网络基础设施超时。该值必须小于 maxLifetime(默认 0,禁用) | ||
keepaliveTime: 30000 | ||
# 连接最大生存时间(默认 1800000 毫秒,30 分钟) | ||
max-lifetime: 1800000 | ||
## Liquibase 配置 | ||
spring.liquibase: | ||
# 是否启用 | ||
enabled: true | ||
# 配置文件路径 | ||
change-log: classpath:/db/changelogs/db.changelog-master.yaml | ||
|
||
--- ### Snail Job 服务端配置 | ||
snail-job: | ||
# Netty 端口 | ||
netty-port: 1788 | ||
# 合并日志默认保存天数 | ||
merge-Log-days: 1 | ||
# 合并日志默认的条数 | ||
merge-Log-num: 500 | ||
# 配置日志保存时间(单位:天) | ||
log-storage: 90 | ||
# 配置每批次拉取重试数据的大小 | ||
retry-pull-page-size: 100 | ||
# 配置一个客户端每秒最多接收的重试数量指令 | ||
limiter: 10 | ||
# 配置号段模式下的步长 | ||
step: 100 | ||
# bucket 的总数量 | ||
bucket-total: 128 | ||
# Dashboard 任务容错天数 | ||
summary-day: 7 | ||
# 配置负载均衡周期时间 | ||
load-balance-cycle-time: 10 | ||
## 回调配置 | ||
callback: | ||
# 回调 uniqueId 前缀 | ||
prefix: CB | ||
# 配置回调的最大执行次数 | ||
max-count: 288 | ||
# 配置回调触发的间隔时间 | ||
trigger-interval: 900 |
26 changes: 26 additions & 0 deletions
26
continew-admin-extension/continew-admin-job-server/src/main/resources/config/application.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- ### Spring 配置 | ||
spring: | ||
application: | ||
name: continew-admin-job-server | ||
|
||
--- ### MyBatis Plus 配置 | ||
mybatis-plus: | ||
# 类型别名扫描包配置 | ||
typeAliasesPackage: com.aizuda.snailjob.template.datasource.persistence.po | ||
## MyBatis 配置 | ||
configuration: | ||
map-underscore-to-camel-case: true | ||
cache-enabled: true | ||
## 全局配置 | ||
global-config: | ||
db-config: | ||
where-strategy: NOT_EMPTY | ||
capital-mode: false | ||
# 逻辑删除全局值(默认 1,表示已删除) | ||
logic-delete-value: 1 | ||
# 逻辑未删除全局值(默认 0,表示未删除) | ||
logic-not-delete-value: 0 | ||
|
||
--- ### 日志配置 | ||
logging: | ||
config: classpath:logback-spring.xml |
3 changes: 3 additions & 0 deletions
3
...nsion/continew-admin-job-server/src/main/resources/db/changelogs/db.changelog-master.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
databaseChangeLog: | ||
- include: | ||
file: db/changelogs/mysql/snail_job.sql |
Oops, something went wrong.