Ver Fonte

添加job管理器配置

caixiaofeng há 6 meses atrás
pai
commit
6d4ef0484d

+ 5 - 0
flow-common/flow-common-flowable-starter/pom.xml

@@ -30,6 +30,11 @@
             <artifactId>flowable-spring-boot-starter-process</artifactId>
             <version>${flowable.version}</version>
         </dependency>
+        <!--<dependency>
+         <groupId>org.flowable</groupId>
+         <artifactId>flowable-jms-spring-executor</artifactId>
+         <version>${flowable.version}</version>
+        </dependency>-->
         <dependency>
             <groupId>org.flowable</groupId>
             <artifactId>flowable-bpmn-converter</artifactId>

+ 14 - 6
flow-common/flow-common-flowable-starter/src/main/java/com/flow/flowable/configure/FlowableConfigure.java

@@ -16,6 +16,7 @@ import org.flowable.common.engine.impl.cfg.IdGenerator;
 import org.flowable.common.engine.impl.persistence.deploy.DeploymentCache;
 import org.flowable.engine.impl.persistence.deploy.ProcessDefinitionCacheEntry;
 import org.flowable.engine.parse.BpmnParseHandler;
+import org.flowable.job.service.impl.asyncexecutor.JobManager;
 import org.flowable.spring.SpringProcessEngineConfiguration;
 import org.flowable.spring.boot.EngineConfigurationConfigurer;
 import org.flowable.task.service.impl.DefaultTaskPostProcessor;
@@ -38,6 +39,8 @@ public class FlowableConfigure implements EngineConfigurationConfigurer<SpringPr
     @Autowired(required = false)
     private DefaultTaskPostProcessor taskPostProcessor;
     @Autowired(required = false)
+    private JobManager jobManager;
+    @Autowired(required = false)
     private DeploymentCache<ProcessDefinitionCacheEntry> deploymentCache;
 
     @Override
@@ -56,21 +59,26 @@ public class FlowableConfigure implements EngineConfigurationConfigurer<SpringPr
         BpmnXMLConverter.addConverter(new CopyServiceTaskXMLConverter());
         BpmnXMLConverter.addConverter(new CustomServiceTaskXMLConverter());
         if (Objects.nonNull(this.objectMapper)) {
-            engineConfiguration.setObjectMapper(objectMapper);
+            engineConfiguration.setObjectMapper(this.objectMapper);
         }
         if (Objects.nonNull(this.idGenerator)) {
-            engineConfiguration.setIdGenerator(idGenerator);
+            engineConfiguration.setIdGenerator(this.idGenerator);
         }
-        if (Objects.nonNull(taskPostProcessor)) {
-            engineConfiguration.setTaskPostProcessor(taskPostProcessor);
+        if (Objects.nonNull(this.taskPostProcessor)) {
+            engineConfiguration.setTaskPostProcessor(this.taskPostProcessor);
         }
         if (Objects.nonNull(this.transactionManager)) {
-            engineConfiguration.setTransactionManager(transactionManager);
+            engineConfiguration.setTransactionManager(this.transactionManager);
         }
         if (Objects.nonNull(this.deploymentCache)) {
-            engineConfiguration.setProcessDefinitionCache(deploymentCache);
+            engineConfiguration.setProcessDefinitionCache(this.deploymentCache);
             engineConfiguration.setProcessDefinitionCacheLimit(1000);
             // engineConfiguration.setProcessDefinitionDataManager(new CustomProcessDefinitionDataManager(engineConfiguration, this.deploymentCache));
         }
+        if (Objects.nonNull(this.jobManager)) {
+            engineConfiguration.setAsyncExecutorActivate(true);
+            engineConfiguration.setAsyncExecutorMessageQueueMode(true);
+            engineConfiguration.setJobManager(jobManager);
+        }
     }
 }