|
@@ -14,8 +14,10 @@ import org.flowable.bpmn.converter.BpmnXMLConverter;
|
|
|
import org.flowable.common.engine.api.delegate.FlowableFunctionDelegate;
|
|
|
import org.flowable.common.engine.impl.cfg.IdGenerator;
|
|
|
import org.flowable.common.engine.impl.persistence.deploy.DeploymentCache;
|
|
|
+import org.flowable.engine.impl.history.HistoryManager;
|
|
|
import org.flowable.engine.impl.persistence.deploy.ProcessDefinitionCacheEntry;
|
|
|
import org.flowable.engine.parse.BpmnParseHandler;
|
|
|
+import org.flowable.job.service.impl.asyncexecutor.AsyncJobExecutorConfiguration;
|
|
|
import org.flowable.job.service.impl.asyncexecutor.JobManager;
|
|
|
import org.flowable.spring.SpringProcessEngineConfiguration;
|
|
|
import org.flowable.spring.boot.EngineConfigurationConfigurer;
|
|
@@ -41,6 +43,8 @@ public class FlowableConfigure implements EngineConfigurationConfigurer<SpringPr
|
|
|
@Autowired(required = false)
|
|
|
private JobManager jobManager;
|
|
|
@Autowired(required = false)
|
|
|
+ private HistoryManager historyManager;
|
|
|
+ @Autowired(required = false)
|
|
|
private DeploymentCache<ProcessDefinitionCacheEntry> deploymentCache;
|
|
|
|
|
|
@Override
|
|
@@ -76,9 +80,25 @@ public class FlowableConfigure implements EngineConfigurationConfigurer<SpringPr
|
|
|
// engineConfiguration.setProcessDefinitionDataManager(new CustomProcessDefinitionDataManager(engineConfiguration, this.deploymentCache));
|
|
|
}
|
|
|
if (Objects.nonNull(this.jobManager)) {
|
|
|
+ AsyncJobExecutorConfiguration jobConf = new AsyncJobExecutorConfiguration();
|
|
|
+ jobConf.setMaxAsyncJobsDuePerAcquisition(100);
|
|
|
+ jobConf.setGlobalAcquireLockEnabled(true);
|
|
|
+ engineConfiguration.setAsyncExecutorConfiguration(jobConf);
|
|
|
engineConfiguration.setAsyncExecutorActivate(true);
|
|
|
engineConfiguration.setAsyncExecutorMessageQueueMode(true);
|
|
|
engineConfiguration.setJobManager(this.jobManager);
|
|
|
}
|
|
|
+ if (Objects.nonNull(this.historyManager)) {
|
|
|
+ engineConfiguration.setHistoryManager(this.historyManager);
|
|
|
+ }
|
|
|
+ // 启用异步历史
|
|
|
+ // engineConfiguration.setAsyncHistoryEnabled(true);
|
|
|
+ // engineConfiguration.setAsyncHistoryExecutorActivate(true);
|
|
|
+ // 启用批量异步历史存储,阈值为3
|
|
|
+ // engineConfiguration.setAsyncHistoryJsonGroupingEnabled(true);
|
|
|
+ // engineConfiguration.setAsyncHistoryJsonGroupingThreshold(3);
|
|
|
+ // 设置异步历史执行线程池的核心线程数和最大线程数
|
|
|
+ // engineConfiguration.setAsyncHistoryExecutorCorePoolSize(20);
|
|
|
+ // engineConfiguration.setAsyncHistoryExecutorMaxPoolSize(40);
|
|
|
}
|
|
|
}
|