У меня проблемы с интеграцией Camunda BPMN со Springboot, я создал файл, содержащий конфигурацию двигателя Camunda
@Bean
public SpringProcessEngineConfiguration processEngineConfiguration() {
SpringProcessEngineConfiguration config = new SpringProcessEngineConfiguration();
log.info("--------------------SpringProcessEngineConfiguration ");
config.setDataSource(datasource);
PlatformTransactionManager platformTransactionManager=new JpaTransactionManager(entityManagerFactory);
config.setTransactionManager(platformTransactionManager);
config.setDatabaseSchemaUpdate("true");
config.setHistory("audit");
config.setJobExecutorActivate(true);
config.setApplicationContext(applicationContext);
return config;
}
@Bean
public ProcessEngineFactoryBean processEngine() {
log.info("--------------------processEngine ");
ProcessEngineFactoryBean factoryBean = new ProcessEngineFactoryBean();
factoryBean.setProcessEngineConfiguration(processEngineConfiguration());
factoryBean.setApplicationContext(applicationContext);
return factoryBean;
}
@Bean
public RepositoryService repositoryService(ProcessEngine processEngine) {
log.info("--------------------repositoryService ");
return processEngine.getRepositoryService();
}
@Bean
public RuntimeService runtimeService(ProcessEngine processEngine) {
log.info("--------------------runtimeService ");
return processEngine.getRuntimeService();
}
@Bean
public TaskService taskService(ProcessEngine processEngine) {
log.info("-------------------- taskService ");
return processEngine.getTaskService();
}
Мне удалось развернуть процесс, я думаю: я нашел 2 таблицы только с данными, ACT_RE_DEPLOYMENT
и ACT_GE_BYTEARRAY
.
Однако я всегда получаю сообщение об ошибке при попытке запустить экземпляр из любого развернутого процесса.
ProcessEngine processEngine = restProcessEngineProvider.getDefaultProcessEngine();
log.info("processEngine {} ",processEngine.getName());
RuntimeService runtimeService = processEngine.getRuntimeService();
log.info("runtimeService");
RepositoryService repositoryService = processEngine.getRepositoryService();
log.info("repositoryService");
InputStream stream = new ByteArrayInputStream(process.getLastXmlDefinition().getBytes(Charset.defaultCharset()));
DeploymentEntity deploymentResult;
try {
deploymentResult = (DeploymentEntity) repositoryService.createDeployment()
.name(name)
.addInputStream(name, stream).deploy();
List<ProcessDefinition> processes= deploymentResult.getDeployedProcessDefinitions();
if (processes!=null)
{
log.info("process not null {} ",processes.size());
}
else
{
log.info("process null");
}
} finally {
stream.close();
}
//read the result
String deploymentId = deploymentResult.getId();
log.info("deployement id {} ",deploymentId);
ProcessDefinition processDef = repositoryService.createProcessDefinitionQuery()
.processDefinitionName(name)
.singleResult();
log.info("process def ...");
//return the process definition id for later query
String processDefinitionId="";
if (processDef!=null)
{
if (processDef.getId()!=null)
processDefinitionId = processDef.getId();
else
log.info("process def id is null");
}
else
{
log.info("process def null ");
}
log.info("deployed success {} ",processDefinitionId);
runtimeService.startProcessInstanceByKey(name);
всегда получаю нулевой процесс def org.camunda.bpm.engine.exception.NullValueException: процессы не развернуты с ключом ...