Flowable 框架中定时任务获取运行时长设置指南
在 Flowable 框架中,可以通过配置相关的参数来设置 Flowable BPMN 引擎在获取定时任务时的运行时长。
- 首先,在 Flowable 的配置文件(如 flowable.cfg.xml)中添加以下配置项:
<property name='asyncExecutorActivate' value='true' />
<property name='asyncExecutorAsyncJobAcquireWaitTime' value='10000' />
其中,asyncExecutorActivate 配置项用于激活异步执行器,asyncExecutorAsyncJobAcquireWaitTime 配置项用于设置获取定时任务的等待时间,单位为毫秒。
- 然后,创建一个用于启动 Flowable 引擎的类,并在其中设置相关的配置项:
import org.flowable.engine.ProcessEngine;
import org.flowable.engine.ProcessEngineConfiguration;
public class FlowableEngine {
public static void main(String[] args) {
ProcessEngineConfiguration configuration = ProcessEngineConfiguration
.createProcessEngineConfigurationFromResource('flowable.cfg.xml');
ProcessEngine processEngine = configuration.buildProcessEngine();
}
}
在以上示例中,createProcessEngineConfigurationFromResource 方法用于加载 Flowable 的配置文件,buildProcessEngine 方法用于构建 Flowable 引擎。
通过以上配置,Flowable BPMN 引擎在获取定时任务时的运行时长将会设置为 10 秒。你可以根据实际需求进行调整。
原文地址: https://www.cveoy.top/t/topic/qmWg 著作权归作者所有。请勿转载和采集!