CMT and jBpm
elvioandrade Feb 24, 2006 10:33 AMHi,
I don't have mutch experience using jBpm and I would like to hear your expertise in order to clarify some doubts that I have.
First I will give a brief explanation of the scenario.
- I have a session bean that is responsable to handle requests and to start workflow processes.
- These requests are performed by other sessions beans.
- The workflow process has several nodes that have ActionHandlers assigned to them in order to perform some logic.
- These handlers are of two types:
- Perform actions on local session beans.
- Perform remote calls to exterior components/systems using rmi or
soap.
Basically i have this:
1.SessionBean1 calls WorkflowSB
2.WorkflowSB creates and starts a workflow process
3.Workflow execution reaches a node and executes an action.
4.ActionHandler performs a call to SessionBean2
If using CMT, do I have the guaranty that SessionBean1 and 2 will run inside the same transaction if both of them configured to REQUIRED?
Another question that I have is that I want to be able to persist the workflow execution, I want to do it in all actions, after each action logic is executed, by specifying a begin-end Transaction only for the saveProcessInstance call. I will have like this in my action handler:
public void execute(ExecutionContext ctx) { this.doActionLogic(ctx); this.saveProcess(); } void doActionLogic() { // this is where the action handler logic is performed // local session bean invocation or remote call using rmi or soap } void saveProcess(ExecutionContext ctx) { ProcessInstance processInstance = ctx.getProcessInstance(); JbpmSession jbpmSession = jbpmSessionFactory.openJbpmSession(); jbpmSession.beginTransaction(); GraphSession graphSession = jbpmSession.getGraphSession(); graphSession.saveProcessInstance(processInstance); jbpmSession.commitTransaction(); jbpmSession.close(); }
Will this transaction be independent from the sessionbean1 transaction?
thanks
Élvio