AnsweredAssumed Answered

Issues implementing rollback/undo functionality

Question asked by cmaron on Feb 15, 2012
Latest reply on Mar 7, 2012 by cmaron
Hello all,

I am trying to implement rollback functionality (aka "Undo") for my Activiti process and I seem to be hitting a snag. I am using the basic idea found here, but adding the concept of a timeout. What I am doing is inserting a user task between the rollback target and some end point. This user task has a timer boundary event which proceeds to the end point after a given time period. The idea is the process should wait at this user task until one of two things happens:
  • The user rolls back to the previous user task

  • The timer fires, moving to the end point.
[attachment=0]Rollback Process.png[/attachment]
In the diagram above, "A" is the user task I want to allow the "undo" action on, and "B" is the user task that should allow this to take place. One can see the timer boundary event on "B", which will proceed to the end once the undo period has elapsed. The timer boundary event has cancelActivity="true", and appears to be attached correctly:


  <process id="RollbackProcess" name="Rollback Process">
    <documentation>Place documentation for the 'Rollback Process' process here.</documentation>
    <startEvent id="startevent1" name="Start"></startEvent>
    <userTask id="usertask1" name="A" activiti:candidateUsers="A"></userTask>
    <userTask id="usertask2" name="B" activiti:candidateGroups="B"></userTask>
    <boundaryEvent id="boundarytimer1" cancelActivity="true" attachedToRef="usertask2">
      <timerEventDefinition>
        <timeDuration>PT48H</timeDuration>
      </timerEventDefinition>
    </boundaryEvent>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow1" name="" sourceRef="startevent1" targetRef="usertask1"></sequenceFlow>
    <sequenceFlow id="flow2" name="" sourceRef="usertask1" targetRef="usertask2"></sequenceFlow>
    <sequenceFlow id="flow3" name="" sourceRef="boundarytimer1" targetRef="endevent1"></sequenceFlow>
    <sequenceFlow id="flow4" name="" sourceRef="usertask2" targetRef="usertask1"></sequenceFlow>
  </process>

The issue I am having is this: The process will reach the end point and not "stop" at user task "B". A job is created (I can see jobs in ACT_RU_JOB for the timer), but the process does not wait where I would expect it to. I have "jobExecutorActivate" set to "true", and have confirmed in the code (via processEngine.getProcessEngineConfiguration().getJobExecutor().isActive()) that it considers itself active.

Any thoughts as to what I am doing wrong? Is there something about user tasks and/or timer boundary events I am missing here? I am using version 5.8 of Activiti.

Attachments

Outcomes