I am rather new to activiti and I am trying to figure out how transaction lifecyle is managed in activiti.
I have read Activiti in Action and checked the source code but I am not so sure to have fully understood when/by who a
transaction i started/completed.
The real life scenario is a JSF app with JDO (DataNucleus) as persistence engine. No Spring, nor annotations.
I have a PhaseListener that take care of starting and completing txn bound the the current FacesContext,
with the app call a setRollbackOnly in case of errors.
Since I don't want to use a real JTA datasource I am putting activiti and application tables in the same database.
From my understanding I should implement a javax.sql.DataSource with getConnection returning the same java.sql.Connection
to JDO and Activiti, while running the same transaction.
Fine and easy (I can bind the connection to the current FacesContext).
As in the SpringTransactionContext (or JtaTransactionContext) I should provide a TransactionContext implementation where
commit() is a NOP while rollback() should just setRollbackOnly in the JDO Transation.
What I miss now is the role of the TransactionInterceptor.
Another thing I don' understand is what should happen when a process starts an async activity.
Is the transaction of the starting activity distinct from the transaction of the async one ?
If so, the transaction of the started activity should be bound to the current thread ?
In the JSF triggered operation, the transaction lifecylce follows JSF lifecycle so I can manage a transaction with a PhaseListener,
in the async case, what is the lifecycle ?