Skip to content

修改集群任务

集群任务可修改参数

参数名参数类型参数值参数规则备注
jobIdLong任务ID
jobNameString任务名称
argsStrString执行任务参数封装了对应新增的方法,通过k,v的形式新增
routeKeyInteger执行器路由策略@link AllocationAlgorithmEnum
executorInfoString执行器名称
triggerTypeInteger触发类型2. 固定时间 3.CRON 表达式 99.工作流
triggerIntervalString间隔时长
blockStrategyInteger阻塞策略1、丢弃 2、覆盖 3、并行
executorTimeoutInteger任务执行超时时间单位:秒
maxRetryTimesInteger最大重试次数
retryIntervalInteger重试间隔单位:秒
descriptionString描述

集群任务修改demo

java
/**
 * 修改集群模式的任务
 */
public Boolean updateClusterJob(Long jobId) {
    return SnailJobOpenApi.updateClusterJob(jobId)
            .setMaxRetryTimes(1)
            .setTriggerType(TriggerTypeEnum.SCHEDULED_TIME)
            .setTriggerInterval(String.valueOf(60))
            .addArgsStr("update测试数据", new Random().nextInt(1000))
            .addArgsStr("updateArg", "args")
            .setRetryInterval(3)
            .execute();
}