common-quartz-spring-boot-starter


License

License

Categories

Categories

Spring Boot Container Microservices Quartz Application Layer Libs Job Scheduling
GroupId

GroupId

com.github.fangzhengjin
ArtifactId

ArtifactId

common-quartz-spring-boot-starter
Last Version

Last Version

0.0.8
Release Date

Release Date

Type

Type

jar
Description

Description

common-quartz-spring-boot-starter
common-quartz-spring-boot-starter
Project URL

Project URL

https://github.com/fangzhengjin/common-quartz-spring-boot-starter
Source Code Management

Source Code Management

https://github.com/fangzhengjin/common-quartz-spring-boot-starter

Download common-quartz-spring-boot-starter

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.fangzhengjin/common-quartz-spring-boot-starter/ -->
<dependency>
    <groupId>com.github.fangzhengjin</groupId>
    <artifactId>common-quartz-spring-boot-starter</artifactId>
    <version>0.0.8</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.fangzhengjin/common-quartz-spring-boot-starter/
implementation 'com.github.fangzhengjin:common-quartz-spring-boot-starter:0.0.8'
// https://jarcasting.com/artifacts/com.github.fangzhengjin/common-quartz-spring-boot-starter/
implementation ("com.github.fangzhengjin:common-quartz-spring-boot-starter:0.0.8")
'com.github.fangzhengjin:common-quartz-spring-boot-starter:jar:0.0.8'
<dependency org="com.github.fangzhengjin" name="common-quartz-spring-boot-starter" rev="0.0.8">
  <artifact name="common-quartz-spring-boot-starter" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.fangzhengjin', module='common-quartz-spring-boot-starter', version='0.0.8')
)
libraryDependencies += "com.github.fangzhengjin" % "common-quartz-spring-boot-starter" % "0.0.8"
[com.github.fangzhengjin/common-quartz-spring-boot-starter "0.0.8"]

Dependencies

compile (5)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-quartz jar 2.2.5.RELEASE
org.reflections : reflections jar 0.9.11
com.github.fangzhengjin : common-core jar 0.0.9
org.jetbrains.kotlin : kotlin-stdlib-jdk8 jar 1.3.70
org.jetbrains.kotlin : kotlin-reflect jar 1.3.70

runtime (1)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-web jar 2.2.5.RELEASE

Project Modules

There are no modules declared in this project.

common-quartz-spring-boot-starter

Codecov branch Build Status Maven Central Bintray License SpringBootVersion

dependencies {
    implementation "com.github.fangzhengjin:common-quartz-spring-boot-starter:version"
}

使用前需配置quartz 配置样例

spring:
  #QuartZ定时任务
  quartz:
    job-store-type: jdbc
    jdbc:
      #手动初始化数据库
      #脚本位置:org.quartz.impl.jdbcjobstore
      initialize-schema: never
    #相关属性配置
    properties:
      org:
        quartz:
          scheduler:
            #调度器实例名称
            instanceName: clusteredScheduler
            #调度器实例编号自动生成
            instanceId: AUTO
          jobStore:
            class: org.quartz.impl.jdbcjobstore.JobStoreTX
            #数据库
            #MYSQL - org.quartz.impl.jdbcjobstore.StdJDBCDelegate
            #PostgreSQL - org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
            driverDelegateClass: org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
            #数据库表前缀
            tablePrefix: QRTZ_
            #是否开启集群模式
            isClustered: true
            #集群监测间隔
            clusterCheckinInterval: 10000
            #是否使用quartz.properties文件配置
            useProperties: false
          threadPool:
            #ThreadPool 实现的类名
            class: org.quartz.simpl.SimpleThreadPool
            #线程数量
            threadCount: 10
            #线程优先级
            threadPriority: 5
            #自创建父线程
            threadsInheritContextClassLoaderOfInitializingThread: true

自定义Job需要使用@QuartzJobDescription注解修饰并描述用途

配置说明 - application.yml

样例均为默认值

customize:
  common:
    quartz:
      #内置Controller基础地址
      baseUrl: /task
      #是否开启内置Controller
      enableController: true
      #是否在Swagger中展示QuartzControllerApi
      showInSwagger: false
      #是否使用内置异常处理器处理QuartzManagerException异常
      catchQuartzManagerException: true
      #任务执行器扫描路径,如不配置则默认扫描@SpringBootApplication修饰的启动类下的子包
      scanExecJobPackages: youBasePackage

因组件使用reflections进行包扫描,启动过程中会出现大量reflections警告,如需屏蔽警告请添加以下配置项

logging:
  level:
    org.reflections: error

Versions

Version
0.0.8
0.0.7
0.0.6
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1