我们目前正在使用activiti v5.22.0,其流程引擎的编程配置如下:
public class ProgrammaticProcessEngineConfiguration implements ProcessEngineLookup {
private static final Logger LOGGER = LoggerFactory.getLogger(ProgrammaticProcessEngineConfiguration.class.getCanonicalName());
private ProcessEngine processEngine;
private ManagedThreadFactory managedThreadFactory;
@Override
public ProcessEngine getProcessEngine() {
managedThreadFactory = getThreadFactory();
final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
final ManagedAsyncJobExecutor managedJobExecutor = new ManagedAsyncJobExecutor() {
@Override
protected void startExecutingAsyncJobs() {
if (threadFactory == null) {
super.startExecutingAsyncJobs();
} else {
if (threadPoolQueue == null) { threadPoolQueue = new ArrayBlockingQueue<>(queueSize); }
if (executorService == null) {
ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(corePoolSize, maxPoolSize, keepAliveTime, TimeUnit.MILLISECONDS, threadPoolQueue, threadFactory) {
@Override
protected void beforeExecute(Thread t, Runnable r) { t.setContextClassLoader(classLoader); }
};
threadPoolExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
executorService = threadPoolExecutor;
}
startJobAcquisitionThread();
}
}
};
managedJobExecutor.setThreadFactory(managedThreadFactory);
final CdiJtaProcessEngineConfiguration cdiJtaProcessEngineConfiguration = new CdiJtaProcessEngineConfiguration();
cdiJtaProcessEngineConfiguration.setTransactionManager(getTransactionManager());
processEngine = cdiJtaProcessEngineConfiguration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE)
.setDataSourceJndiName("something").setDatabaseType("something")
.setHistoryLevel(HistoryLevel.NONE)
.setTransactionsExternallyManaged(true).setJobExecutorActivate(true)
.setAsyncExecutorEnabled(true)
.setAsyncExecutorActivate(true)
.setAsyncExecutor(managedJobExecutor)
.setClassLoader(Thread.currentThread().getContextClassLoader())
.buildProcessEngine();
return processEngine;
}
当迁移到v6.0.0时,我们希望维护流程实例的向后兼容行为,因此请设置以下内容:
cdiJtaProcessEngineConfiguration.setActiviti5CompatibilityEnabled(true);
我们需要流程引擎同时支持JTA和CDI。但是,迁移页面(https://www.activiti.org/migration)上的说明不是很清楚,我不确定如何配置流程引擎。
激活兼容模式时,出现以下错误:Unsupported process engine configuration
。
是否有人熟悉使用CdiJtaProcessEngineConfiguration将Activiti迁移到v6.0.0?
谢谢