I have a question regard transactions and the activiti workflow. Here is the description of my problem:
We get a request from a external system. Within the request processor we start a new transaction, create our entities AND Start deployed activiti processes. My problem is that the processes starts directly after calling the start function in the activiti engine. The engine will not wait for the transaction to commit.
I´ve expected the following:
1. Start transaction within out logic
2. Create entities that belong to the process
3. Tell the engine to start a activiti process(Write process instance stuff in db)
4. Transaction commit.
–> Now the activiti process should with its first activiti. With this engine configuration activiti commits its data with MY transaction, but the process execution starts immediately after starting the process.
CdiJtaProcessEngineConfiguration config = new CdiJtaProcessEngineConfiguration();
config.setTransactionManager(getTransactionManager());
config.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
config.setTransactionsExternallyManaged(true);
config.setDataSourceJndiName("openejb:Resource/xxx");
config.setEnableProcessDefinitionInfoCache(true);
config.setAsyncExecutorEnabled(true);
config.setAsyncExecutorActivate(true);
config.setPostBpmnParseHandlers(Arrays.asList(new CdiEventSupportBpmnParseHandler()));
// EntityManagerFactory emf = Persistence.createEntityManagerFactory("xxx");
// config.setJpaEntityManagerFactory(emf);
config.setJpaHandleTransaction(false);
config.setJpaCloseEntityManager(false);
Some hints?