3 Replies Latest reply on Sep 9, 2008 4:31 PM by Ronald van Kuijk

    process-end behavior

    taskManager Newbie

      I am wondering event type process-end does. I have two nodes (A and B) forked from a parent node and joined back to a subsequent node.

      Node A has an action to send email notification. A is not JBPM email node. It just sends through a regular smtp service.

      Node B has an action to execute some program.

      Since the fork process does not have a specific order of which node to runs first, in case node A runs first and node B fails, I need to hold back sending email from node A. I thought using an event type "process-end" on node A's email action would do the trick, so when node B's action failed, the JBPM transaction is rolled back at node B, the process will not end.

      It seems the email notification is still sent, even I have "process-end" in place. What is the expected behavior of event type "process-end"?

      Thanks a lot!

        • 1. Re: process-end behavior
          Ronald van Kuijk Master

          the process-end event fires when the process ends.

          Without your processdefinition it is hard to see what could be wrong.

          • 2. Re: process-end behavior
            taskManager Newbie

            Firstly, the process instance was associated with the old definition so it was correct that the email was sent. My bad.

            Now I have a new process instance associated with the new definition (below). Now even both node A and B complete successfully, the email was never sent. The reason is the event at node A SEND_APPROVE_EMAIL_TO_REQUESTOR) was never fired.

            Is it legal to have event type="process-end" at a node which is not an END node?


            <?xml version="1.0" encoding="UTF-8"?>
            
            <process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="MY_PROCESS_DEF">
            
            
             <start-state name="START">
             <transition to="APPROVAL" name="to APPROVAL"></transition>
             </start-state>
            
            
             <task-node name="APPROVAL">
             <task name="mypackage.ApproverAssignmentHandler">
             <assignment class="mypackage.ApproverAssignmentHandler"></assignment>
             </task>
             <transition to="fork for approve path" name="approve"></transition>
             <transition to="fork for reject path" name="reject"></transition>
             <transition to="fork for cancel path" name="cancel"></transition>
             </task-node>
            
             <node name="SEND_APPROVE_EMAIL_TO_REQUESTOR">
             <event type="process-end">
             <action name="mypackage.ApprovedEmailActionHandler" class="mypackage.ApprovedEmailActionHandler"></action>
             </event>
             <transition to="join for approve path" name="from SEND_APPROVE_EMAIL_TO_REQUESTOR"></transition>
             </node>
            
             <node name="EXECUTE_REQUESTED_PROGRAM">
             <action class="mypackage.ExeRequestProgramActionHandler" name="mypackage.ExeRequestProgramActionHandler" accept-propagated-events="false"></action>
             <transition to="join for approve path" name="from EXECUTE_REQUESTED_PROGRAM "></transition>
             </node>
            
             <node name="SEND_REJECT_EMAIL_TO_REQUESTOR">
             <event type="process-end">
             <action name="mypackage.RejectedEmailActionHandler" class="mypackage.RejectedEmailActionHandler"></action>
             </event>
             <transition to="join for reject path" name="from SEND_REJECT_EMAIL_TO_REQUESTOR"></transition>
             </node>
            
             <node name="DELETE_REQUEST_DATA">
             <action class="mypackage.DeleteRequestDataActionHandler" name="mypackage.DeleteRequestDataActionHandler" accept-propagated-events="false"></action>
             <transition to="join for reject path" name="from DELETE_REQUEST_DATA"></transition>
             </node>
            
             <fork name="fork for approve path">
             <transition to="SEND_APPROVE_EMAIL_TO_REQUESTOR" name="to SEND_APPROVE_EMAIL_TO_REQUESTOR"></transition>
             <transition to="EXECUTE_REQUESTED_PROGRAM" name="to EXECUTE_REQUESTED_PROGRAM "></transition>
             </fork>
            
             <fork name="fork for reject path">
             <transition to="SEND_REJECT_EMAIL_TO_REQUESTOR" name="to SEND_REJECT_EMAIL_TO_REQUESTOR"></transition>
             <transition to="DELETE_REQUEST_DATA" name="to DELETE_REQUEST_DATA "></transition>
             </fork>
            
             <join name="join for approve path">
             <transition to="END" name="from join for approve path"></transition>
             </join>
            
             <join name="join for reject path">
             <transition to="END" name="from join for reject path"></transition>
             </join>
            
             <fork name="fork for cancel path">
             <transition to="SEND_TIMEOUT_EMAIL_TO_REQUESTOR" name="to SEND_TIMEOUT_EMAIL_TO_REQUESTOR"></transition>
             <transition to="DELETE_REQUEST_DATA_DUE_TO_CANCEL" name="to DELETE_REQUEST_DATA_DUE_TO_CANCEL"></transition>
             </fork>
            
             <node name="SEND_TIMEOUT_EMAIL_TO_REQUESTOR">
             <event type="process-end">
             <action name="mypackage.TimedOutEmailActionHandler" class="mypackage.TimedOutEmailActionHandler"></action>
             </event>
             <transition to="join for cancel path" name="from SEND_TIMEOUT_EMAIL_TO_REQUESTOR"></transition>
             </node>
            
             <node name="DELETE_REQUEST_DATA_DUE_TO_CANCEL">
             <event type="process-end">
             <action name="mypackage.DeleteRequestDataActionHandler" class="mypackage.DeleteRequestDataActionHandler"></action>
             </event>
             <transition to="join for cancel path" name="from DELETE_REQUEST_DATA_DUE_TO_CANCEL"></transition>
             </node>
            
             <join name="join for cancel path">
             <transition to="END" name="from join for cancel path"></transition>
             </join>
            
            
             <end-state name="END"></end-state>
            
            
            </process-definition>
            


            • 3. Re: process-end behavior
              Ronald van Kuijk Master

               


              Is it legal to have event type="process-end" at a node which is not an END node?
              Hmm... maybe not definitionwise, not sure though what the behaviour is in case there is a token in a none-end-state node at the time a process ends.... It is very uncommon though. You can probably get the same result when moddeling differently