美文网首页
Openjob Distributed task schedul

Openjob Distributed task schedul

作者: wuyuan0127 | 来源:发表于2024-01-15 16:52 被阅读0次

    1.  install openjob-server

            1.1  docker pull openjob/openjob-server:latest

            1.2  create .env file

             1.3  AKKA_REMOTE_HOSTNAME=LocalIP

    2.  add jars

            io.openjob.worker/openjob-worker-spring-boot-starter/1.0.7

    3.  support springboot3.x version

            @Configuration

            @ImportAutoConfiguration(value = {OpenjobWorkerAutoConfiguration.class})

            public class OpenJobConfig {

            }

    4. config application.yml

    5. static sharding 

    @Component

    @Slf4j

    public class ShardingAnnotationProcessor {

    @Openjob("annotationShardingProcessor")

    public ProcessResultshardingProcessor(JobContext jobContext) {

    log.info("Sharding annotation processor execute success! shardingId={} shardingNum={} shardingParams={}",

    jobContext.getShardingId(), jobContext.getShardingNum(), jobContext.getShardingParam());

    log.info("jobContext={}", jobContext);

    return ProcessResult.success();

    }

    }

    6. more --> execute

    相关文章

      网友评论

          本文标题:Openjob Distributed task schedul

          本文链接:https://www.haomeiwen.com/subject/zrjhodtx.html