添加 Controller 类

代码如下:

@RestController
public class MyController {
    @Autowired
    private ProcessRuntime processRuntime;
    @Autowired
    private TaskRuntime taskRuntime;
    @Autowired
    private SecurityUtil securityUtil;
}

实现任务完成

@RequestMapping("testTask")
    public void testTask() {
        Page<Task> taskPage = taskRuntime.tasks(Pageable.of(0, 10));
        if (taskPage.getTotalItems() > 0) {
            for (Task task : taskPage.getContent()) {
                taskRuntime.claim(TaskPayloadBuilder.claim().withTaskId(task.getId()).build());
                System.out.println("任务:" + task);
                taskRuntime.complete(TaskPayloadBuilder.complete().withTaskId(task.getId()).build());
            }
        }
        Page<Task> taskPage2 = taskRuntime.tasks(Pageable.of(0, 10));
        if (taskPage2.getTotalItems() > 0) {
            System.out.println("任务:" + taskPage2.getContent());
        }
    }

编写 SpringBoot 启动类

@SpringBootApplication(exclude = SecurityAutoConfiguration.class)
public class ActvitiApplication {
	private Logger logger = LoggerFactory.getLogger(ActvitiApplication.class);



	public static void main(String[] args) {
		SpringApplication.run(ActvitiApplication.class, args);
	}

	@Bean
	public Connector testConnector() {
		return integrationContext -> {
			logger.info("我被调用啦~~");
			return integrationContext;
		};
	}
}
07-19 09:32