AnsweredAssumed Answered

Activiti transaction + JEE transactions

Question asked by jsher on Jan 3, 2012
Latest reply on Oct 22, 2012 by frederikheremans1

Apologies for these basic questions - I have limited JEE knowledge, but here goes…

I am trying to build a picture of how Activiti will behave in a JEE setting, particularly from a persistence/transactions point of view. I am considering only JEE6 container managed persistence for the moment. I see a couple of different types of interactions and process flows in this regard…

1. Session bean service method invoked in a CMP transaction. Bean invokes Activiti (RS.startProcess(), RS.signal(), TS.complete(), etc). Process executes a JavaDelegate task which in turn invokes methods on EJBs, then reaches a wait state at which changes are persisted.
Q1 - Am I correct in saying that if I use JtaProcessEngineConfiguration, transactionsExternallyManaged=true, and configure data sources appropriately then all persistence operations performed by Activiti will be done in the same transaction as the EJB CMP ?
Q2 - If the answer to the previous is yes, would I be correct in saying that the security context (principal, etc) would be propagated from the initiating session bean, via Activiti, to the EJB invoked by the delegate task ?

2. My process uses a timer or async continuation in which case Activiti executes subsequent tasks in a JobExecutor thread. These tasks may invoke EJBs.
Q3 - How can we avoid violating JEE restriction on managing threads outside of control of the container ?
Q4 - How can execution of these tasks be made to participate in a CMP transaction ? I can't see anything in doc or code to help deal with this. I have read a bit of how jBPM provides for JMS queue for async and I assume this is how jBPM deals with this, and since I understand that Activiti and jBPM share a common heritage I was expecting to see something similar for Activiti.

I'd appreciate some help in answering these questions.