Power-job OpenAPI使用方法
官网文档: https://www.yuque.com/powerjob/guidence/olgyf0。
·
- 引入依赖
注意:版本必须一致, 否则可能会找不到worker
<dependency>
<groupId>tech.powerjob</groupId>
<artifactId>powerjob-worker-spring-boot-starter</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>tech.powerjob</groupId>
<artifactId>powerjob-client</artifactId>
<version>4.0.1</version>
</dependency>
2.手动调用API
PowerJobClient client = new PowerJobClient("127.0.0.1:7700", "test-app", "123456");
SaveJobInfoRequest request = new SaveJobInfoRequest();
request.setJobName("PORTAL_TASK_01");
request.setJobDescription("PORTAL_TASK");
request.setTimeExpressionType(TimeExpressionType.CRON);
request.setTimeExpression("0/10 * * * * ?");
request.setExecuteType(ExecuteType.STANDALONE);
request.setProcessorType(ProcessorType.BUILT_IN);
request.setProcessorInfo("com.gigrt.nrs.service.task.BasicProcessorDemo");
request.setAppId(2L);
JobInfoQuery powerQuery = new JobInfoQuery();
powerQuery.setJobNameEq("PORTAL_TASK_01");
ResultDTO<List<JobInfoDTO>> listResultDTO = client.queryJob(powerQuery);
listResultDTO.getData().forEach(jobInfoDTO -> {
client.deleteJob(jobInfoDTO.getId());
});
ResultDTO<Long> longResultDTO = client.saveJob(request);
System.out.println(longResultDTO);
官网文档: https://www.yuque.com/powerjob/guidence/olgyf0
更多推荐
所有评论(0)