<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
jBPM 5.3 - simple workflow w/ non-terminating end event that terminates the process
</h3>
<span style="margin-bottom: 10px;">
created by <a href="https://community.jboss.org/people/eodsf">eodsf</a> in <i>jBPM</i> - <a href="https://community.jboss.org/message/776288#776288">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p><a href="https://community.jboss.org/servlet/JiveServlet/showImage/2-776288-19879/sample3.png"><span> https://community.jboss.org/servlet/JiveServlet/downloadImage/2-776288-19879/450-246/sample3.png </span></a></p><p>Hi,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>My company is evaluating jBPM, and I'm coming up to speed on it. While trying out some things in the Eclipse modeler & testing w/ unit tests, I've run into some issues w/ early experimentation. This is likely to be the first of some posts as I try to model what we need in our business execution & find out what is feasible.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>The above is an example of a simple workflow I have that have that terminates early before I can send in an event that will trigger the 'Main task'; acc.to the documentation '</p><p><a class="jive-link-anchor-small"><p>A Signal Event should have no incoming connections and one outgoing connection' (<a class="jive-link-external-small" href="http://docs.jboss.org/jbpm/v5.1/userguide/ch05.html">http://docs.jboss.org/jbpm/v5.1/userguide/ch05.html</a>),  suggesting that this workflow should wait for a signal event of the type expected before executing the 'Main task' and then terminating. What I am seeing in my unit test is that after executing the 'Initial' task, the process instance is in a 'STATE_COMPLETE' (2) state. Further code that signals events w/ the expected event type (ksession1.signalEvent(....)) does not trigger execution of the 'Main task' (nor does it throw any exceptions or errors). </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Some snippets from my test & log below :</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><table><tbody><tr><td style=";"><br/></td><td style=";"><br/></td><td style=";">ProcessInstance pi = ksession1.startProcess("unknownQC");</td></tr><tr><td style=";"><br/></td><td style=";"><br/></td><td style=";"><br/></td></tr><tr><td style=";"><br/></td><td style=";"><br/></td><td style=";">long pid = pi.getId();</td></tr><tr><td style=";"><br/></td><td style=";"><br/></td><td style=";">System.out.println("Process instance started ... id = " + pid);</td><td style=";"><br/></td><td style=";"><br/></td><td style=";"><br/></td><td style=";"><br/></td></tr><tr><td style=";"><br/></td><td style=";"><br/></td><td style=";">boolean stillActive = ProcessInstance.STATE_COMPLETED != pi.getState();</td></tr><tr><td style=";"><br/></td><td style=";"><br/></td><td style=";">System.out.println("Process still active ? " + stillActive + " : state = " + pi.getState());</td></tr><tr><td style=";"><br/></td><td style=";"><br/></td><td style=";"><br/></td></tr></tbody></table><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Retreiving session ... id = 61</p><p><a class="jive-link-anchor-small"><p style="display: inline !important;">BEFORE RULEFLOW STARTED process:Sample Process[id=unknownQC]</p></a></p><p>BEFORE PROCESS NODE TRIGGERED node:StartProcess[id=1] process:Sample Process[id=unknownQC]</p><p>BEFORE PROCESS NODE EXITED node:StartProcess[id=1] process:Sample Process[id=unknownQC]</p><p>BEFORE PROCESS NODE TRIGGERED node:Initial[id=2] process:Sample Process[id=unknownQC]</p><p>>>>>>>> Completing job</p><p>>>>>>>> Process Id = 79</p><p>>>>>>>> Work Item Id = 218</p><p>>>>>>>> Work Item Name = Jbpm</p><p>Work Item parameter = WORKFLOW_PROCESS_NAME  value =  unknownQC</p><p>Work Item parameter = WORKFLOW_TASK_HANDLER  value =  jobAccepted</p><p>Work Item parameter = WORKFLOW_TASK_NAME  value =  Job Accepted</p><p>BEFORE PROCESS NODE EXITED node:Initial[id=2] process:Sample Process[id=unknownQC]</p><p>BEFORE PROCESS NODE TRIGGERED node:End[id=11] process:Sample Process[id=unknownQC]</p><p>BEFORE PROCESS NODE EXITED node:End[id=11] process:Sample Process[id=unknownQC]</p><p>BEFORE RULEFLOW COMPLETED process:Sample Process[id=unknownQC]</p><p>AFTER RULEFLOW COMPLETED process:Sample Process[id=unknownQC]</p><p>AFTER PROCESS NODE TRIGGERED node:End[id=11] process:Sample Process[id=unknownQC]</p><p>AFTER PROCESS NODE TRIGGERED node:End[id=11] process:Sample Process[id=unknownQC]</p><p>AFTER PROCESS NODE TRIGGERED node:Initial[id=2] process:Sample Process[id=unknownQC]</p><p>AFTER PROCESS NODE TRIGGERED node:Initial[id=2] process:Sample Process[id=unknownQC]</p><p>AFTER PROCESS NODE TRIGGERED node:StartProcess[id=1] process:Sample Process[id=unknownQC]</p><p>AFTER PROCESS NODE TRIGGERED node:StartProcess[id=1] process:Sample Process[id=unknownQC]</p><p>AFTER RULEFLOW STARTED process:Sample Process[id=unknownQC]</p><p>Process instance started ... id = 79</p><p>Process still active ? false : state = 2</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Should this workflow work as expected ? Am I missing something obvious ?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>The above btw is a simplifcation of a larger workflow I'm working on, which will require being able to accept multiple events of any type (and multiple of the same tyoe) at any time before terminating if an event of a certain type is receievd ... but baby steps, I want to know why the above doesn't work so I can plan accordingly on what constructs I have at my disposal.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Thanks !</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>PS. I'm placing this in the jBPM 5.2 category b/c there is no 5.3 one (can somone add that please?), and taggint it w/ jBPM 5.3.0.final</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></a></p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/776288#776288">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in jBPM at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>