# spring-boot-starter-elasticjob-annotation **Repository Path**: luckydog-tjs/spring-boot-starter-elasticjob-annotation ## Basic Information - **Project Name**: spring-boot-starter-elasticjob-annotation - **Description**: 以pom形式引入该starter,可以 以注解的形式 使用ElasticJob,简单易上手。 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2023-05-12 - **Last Updated**: 2023-07-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README Elastic-job:https://shardingsphere.apache.org/elasticjob/index_zh.html 官方使用Elastic-job的形式是基于繁琐的配置文件 或者 是配置类。 此项目将Elastic-job 的使用简化为 **注解的形式【官方没有提供】**进行分布式任务调度。 ## 使用示例 1. 通过maven打包到本地仓库 2. 引入依赖 3. 配置文件 ```properties regcenter.namespace=elastic‐job‐springboot-starter #[必须*] regcenter.server-list=124.70.110.9:2181 #[必须*] regcenter.base-sleep-time-milliseconds=1000 #[默认可不配置] regcenter.connection-timeout-milliseconds=15000 #[默认可不配置] regcenter.max-retries=3 #[默认可不配置] regcenter.max-sleep-time-milliseconds=3000 #[默认可不配置] regcenter.session-timeout-milliseconds=60000 #[默认可不配置] ``` 4. 使用注解 ```java @ElasticJobConfig(jobName = "FileBackupJob2222",cron = "0/3 * * * * ?",shardingTotalCount = 2) @Component public class FileBackupJob implements SimpleJob { @Override public void execute(ShardingContext shardingContext) { //任务执行... } } ``` 支持 SimpleJob 和 DataflowJob。更多相关配置信息阅读官网文档:[概览 :: ElasticJob (apache.org)](https://shardingsphere.apache.org/elasticjob/current/cn/overview/) zookeeper相关配置以配置文件的形式配置 任务相关的配置以注解的形式配置