Activiti 6 async process - transaction control

cancel
Showing results for 
Search instead for 
Did you mean: 
artur17
Member II

Activiti 6 async process - transaction control

Hi,

1. I have simple proces where the first serivce task (interface JavaDelegate) is set as async (so the whole process is asynchronic).

2. Activiti 6 with Spring Boot and I use spring-boot-starter-data-jpa.

3. I have one more table of my own in the same database schema as Activiti. So I also use one @Repository bean class with @Transactional annotation.

When I try to make a selection on this table, I get an error: javax.persistence.TransactionRequiredException: no transaction is in progress.

3. Note: If I start the process synchronously (the first User Task is not marked as async), everything works fine. 

My setup:

SpringProcessEngineConfiguration cfg = new SpringProcessEngineConfiguration();
HikariDataSource ds = (HikariDataSource) dataSource;

cfg.setDatabaseSchema(activitiUserName);
cfg.setAsyncExecutorActivate(true);
cfg.setDataSource(ds);
cfg.setProcessEngineName(processEngineName);
cfg.setHistoryLevel(HistoryLevel.FULL);
cfg.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
cfg.setTransactionManager(txManager);
cfg.setBeans(new SpringBeanFactoryProxyMap(applicationContext));

ProcessEngine engine = cfg.buildProcessEngine();

Please tell me why I have trouble retrieving data from the table in the asynchronous process?