我使用边界计时器,它不起作用。如果计时器之后没有元素,则过程继续此顺序流。如果计时器之后有服务任务,则过程将在正常路径上进行。这是我的bpm计划的一部分:
我使用Spring 5为Activiti创建bean。这是我的bean配置类的示例:
@Bean
SpringProcessEngineConfiguration processEngineConfiguration(@Qualifier("dataSourceForActiviti") DataSource dataSourceForActiviti,
@Qualifier("transactionManagerForActiviti") PlatformTransactionManager transactionManagerForActiviti) {
SpringProcessEngineConfiguration processEngineConfiguration = new SpringProcessEngineConfiguration();
processEngineConfiguration.setTransactionManager(transactionManagerForActiviti);
processEngineConfiguration.setDataSource(dataSourceForActiviti)
.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE)
.setAsyncExecutorActivate(true)
;
processEngineConfiguration.setDeploymentResources(new Resource[]{
new ClassPathResource("bpm/LicensingProcess.bpmn20.xml"),
new ClassPathResource("bpm/ReissuanceLicenseProcess.bpmn20.xml"),
new ClassPathResource("bpm/IssueOfDuplicateProcess.bpmn20.xml"),
new ClassPathResource("bpm/IssuanceOfCopyProcess.bpmn20.xml"),
new ClassPathResource("bpm/TerminationOfLicenseProcess.bpmn20.xml"),
new ClassPathResource("bpm/ExtractFromRegisterOfLicensesProcess.bpmn20.xml")
});
return processEngineConfiguration;
}
@Bean
ProcessEngineFactoryBean processEngineFactoryBean(SpringProcessEngineConfiguration processEngineConfiguration) {
ProcessEngineFactoryBean processEngineFactoryBean = new ProcessEngineFactoryBean();
processEngineFactoryBean.setProcessEngineConfiguration(processEngineConfiguration);
return processEngineFactoryBean;
}
@Bean
RepositoryService repositoryService(ProcessEngineFactoryBean processEngineFactoryBean) throws Exception {
return processEngineFactoryBean.getObject().getRepositoryService();
}
@Bean
RuntimeService runtimeService(ProcessEngineFactoryBean processEngineFactoryBean) throws Exception {
return processEngineFactoryBean.getObject().getRuntimeService();
}
@Bean
TaskService taskService(ProcessEngineFactoryBean processEngineFactoryBean) throws Exception {
return processEngineFactoryBean.getObject().getTaskService();
}
我尝试对setAsyncExecutorActivate(true)
行进行注释和取消注释,没有区别。同时,如果将计时器作为一个单独的单元,则一切正常。
PS我刚刚找到了这样的解决方案(正在将其添加到'ProcessEngineConfiguration
'bean的定义中):
// Async Job Executor
final DefaultAsyncJobExecutor asyncExecutor = new DefaultAsyncJobExecutor();
asyncExecutor.setMaxPoolSize(50);
asyncExecutor.setQueueSize(100);
processEngineConfiguration.setAsyncExecutor(asyncExecutor);
但这也没有帮助我。尽管没有asyncJobExecutor
是null
。
PSS同时,类似的方案在Activiti Modeler中也可以很好地工作。而且我不明白为什么它在那里起作用而对我不起作用
PSSS我已经在Swing
上编写了一个简单的应用程序,没有使用Spring
。我使用了StandaloneProcessEngineConfiguration
类,而没有使用SpringProcessEngineConfiguration
和ProcessEngineFactoryBean
类。它可以工作,但是如果我将服务任务或脚本任务放在boundary timer
之后(而不是将计时器事件作为单独的元素),则它确实可以工作。它写道,它找不到用于Groovy的引擎(对于script task
),并且它写道它无法实例化指定的类(对于service task
)。如果user task
之后有boundary timer
,则可以使用。