一、集成步骤
1、添加 ElasticJob 的依赖
引入相关依赖到pom.xml
<!-- Elastic-Job -->
<dependency>
<groupId>org.apache.shardingsphere.elasticjob</groupId>
<artifactId>elasticjob-lite-spring-boot-starter</artifactId>
<version>3.0.1</version>
</dependency>
2、配置 ElasticJob
在application.properties添加ElasticJob 的配置
# 注册中心的地址
elasticjob.reg-center.server-lists=localhost:2181
# 注册中心的命名空间,用于区分不同的应用
elasticjob.reg-center.namespace=forlan-elastic-job
# 作业类名
elasticjob.jobs.mySimpleJob.elasticJobClass=cn.forlan.j

本文详细介绍了如何集成ElasticJob,包括添加依赖、配置、定义Job,以及ElasticJob-UI的使用。重点讲解了Elastic-Job的分片机制和其背后的原理,如任务分片、调度、执行和监控。
最低0.47元/天 解锁文章
3万+

被折叠的 条评论
为什么被折叠?



