1 Reply Latest reply on Dec 1, 2010 5:36 PM by Yang Yang Qian

    Modelling a Process Cancellation

    Yang Yang Qian Newbie

      Hi all,

       

      I am a new user to jBPM and I've been trying to use it as a simple state-machine to model a process-cancellation proof-of-concept.

       

      My aim is to define a workflow where two approvers need to sequentially approve a request that has been submitted. At any point in the process, someone, for example the person for whom the request was made, can cancel / withdraw the request. As soon as the request is cancelled, all tasks / executions / states must stop.

       

      (I suppose I'm trying to implement the type of pattern that is decribed here http://www.workflowpatterns.com/patterns/control/cancellation/wcp20.php ... perhaps it's over-described )

       

      My current process definition tries to do this by introducing a Monitor state that lasts until there is an external event to trigger the "cancel" transition, at which time the process goes to the cancel end state and stops the other executions. But creating a Monitor state purely for cancellation seems rather awkward ...

       

      I wasn't sure what the recommended practice for modelling a process cancellation would be in jBPM ... I've found some posts on using the API (the ExecutionService.deleteProcessInstance() function I suppose?) but I am not sure that doing so is correct since that will be a runtime solution? I suppose I can call it at runtime from the servlet associated with the cancellation button? Or is there a more elegant model-based solution?

       

      Thanks all!

       

       

       

      test_Cancellation_Model.jpdl.xml:

      <?xml version="1.0" encoding="UTF-8"?>
      
      <process name="test" xmlns="http://jbpm.org/4.4/jpdl">
      
         <start g="39,68,48,48" name="Start">
            <transition to="fork1"/>
         </start>
         
         <fork g="135,158,48,48" name="fork1">
            <transition to="Approval 1"/>
            <transition to="Monitor"/>
         </fork>
         
         <state g="115,272,92,52" name="Monitor">
            <transition g="-39,-18" name="cancel" to="End - Cancelled Request"/>
         </state>
         
         <state g="247,154,92,52" name="Approval 1">
            <on event="start"><event-listener class="OnApprovalListener1"/></on>
            <transition g="-30,-4" name="approve" to="Approval 2"/>
            <transition g="-34,-18" name="reject" to="End - Rejected Request"/>
         </state>
      
         <state g="396,60,92,52" name="Approval 2">
            <on event="start"><event-listener class="OnApprovalListener2"/></on>
            <transition g="-25,-9" name="approve" to="End - Approved Request"/>
            <transition g="-4,-8" name="reject" to="End - Rejected Request"/>
         </state>
         
         <end g="638,77,48,48" name="End - Approved Request" state="Completed"/>
         
         <end g="635,154,48,48" name="End - Rejected Request" state="Rejected"/>
         
         <end-cancel g="641,277,48,48" name="End - Cancelled Request"/>
         
      </process>
      
        • 1. Re: Modelling a Process Cancellation
          Yang Yang Qian Newbie

          ok ... from reading up on other articles and blogs regarding jBPM 4 ... it looks like that jBPM 4.4 is no longer being worked on?

           

          So ... I guess the question now is do I switch to jBPM 5 or jBPM 3 or Activiti?

           

          I'm not expecting an exact positive answer, just some confirmation that jBPM 4.4 is definitely not something I should be investing any time in.

           

          Thanks.