4 Replies Latest reply on Apr 26, 2007 10:37 AM by fbecaria

    Transaction demarcation in synchronous nodes

    jurglic

      Hello there,


      I have a problem with transaction demarcation in synchronous nodes. As far as I can see, the only simple way to enforce transaction demarcation is to set async="true" on the node element in process definition. But in my case, I want synchronous processing with transaction demarcation.

      Imagine the following process (just sequential nodes):
      1. start-node
      2. task-node : userDataInput
      3. action-node : creditCardAuthorization
      4. action-node : processOrder
      5. task-node : successMessage
      5. end-state

      In this example, I want synchronous processing over all nodes. Initially process is started and task instance is created (userDataInput). After the user completes the first task (userDataInput) the process must continue with processing creditCardAuthorization and processOrder actions. After this is done, the new task (successMessage) is waiting for the user and the user thread will start it right after it concluded the first task (userDataInput).

      But if processOrder action fails, the process roll backs to the task-node userDataInput. If the user wishes to try again, she needs to input data again and creditCardAuthorization will be processed for the 2nd time, which is definately not what we want.

      So the ideal solution would be to set all the nodes in the process (userDataInput, creditCardAuthorization, processOrder, successMessage) to be processed in separate transaction, but synchronously.

      Would it be possible to include setting like that in the next jbpm release?


      There is also a possible workaround, to se the action handlers on transition that commit the transaction and start a new one.