<!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;">
    Signal Event is not happening in persisted process
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/ravichandrankg">ravichandrankg</a> in <i>jBPM</i> - <a href="https://community.jboss.org/message/751377#751377">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hi,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>In our company, we are doing some sample process implementation for our application, to decide which BPM engine to be use. It mostly have external system communication, that will trigger the next set of activities in our application.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I am using the following sample process, with one human task and two script tasks with signal events (to trigger from external applications).</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><a href="https://community.jboss.org/servlet/JiveServlet/showImage/2-751377-19130/Untitled.png"><span> https://community.jboss.org/servlet/JiveServlet/downloadImage/2-751377-19130/450-88/Untitled.png </span></a></p><p>and first signal event is having the properties as below,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><a href="https://community.jboss.org/servlet/JiveServlet/showImage/2-751377-19132/properties.jpg"><span> https://community.jboss.org/servlet/JiveServlet/downloadImage/2-751377-19132/310-138/properties.jpg </span></a></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I am using JBPM 5.3.0.Final version, JBOSS 5.1 and MySQL 5.5. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I am creating a single knowledge session for whole my web application (singleton object holder class, initializing at server startup time). I am creating the process as,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><em>&#160;&#160;&#160;&#160; StatefulKnowledgeSession jbpmsession = util.getSession();</em></p><p><em>&#160;&#160;&#160;&#160; UserTransaction ut = (UserTransaction) new InitialContext().lookup( "java:comp/UserTransaction" );</em></p><p><em>&#160;&#160;&#160;&#160; ut.begin();</em></p><p><em>&#160;&#160;&#160;&#160; ProcessInstance instance = jbpmsession.startProcess("IngestMetadataAndFile", props);</em></p><p><em>&#160;&#160;&#160;&#160; jbpmsession.insert(instance);</em></p><p><em>&#160;&#160;&#160;&#160; ut.commit();</em></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>and the getSession method will return the new session for first time, and reloaded session there after, using the following code.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160; </p><p>&#160;&#160;&#160;&#160; <em>StatefulKnowledgeSession sessionobj = null;</em></p><p><em>&#160;&#160;&#160;&#160; Properties properties = new Properties();</em></p><p><em>&#160;&#160;&#160;&#160; properties.put("drools.processInstanceManagerFactory", "org.jbpm.persistence.processinstance.JPAProcessInstanceManagerFactory");</em></p><p><em>&#160;&#160;&#160;&#160; properties.put("drools.processSignalManagerFactory", "org.jbpm.persistence.processinstance.JPASignalManagerFactory");</em></p><p><em>&#160;&#160;&#160;&#160; KnowledgeSessionConfiguration config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(properties);</em></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><em>&#160;&#160;&#160;&#160; if (sessionId == -1) {</em></p><p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sessionobj = JPAKnowledgeService.newStatefulKnowledgeSession( kbase, config, env );</em></p><p><em>&#160;&#160;&#160;&#160; } else {</em></p><p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;try {</em></p><p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;sessionobj =&#160; JPAKnowledgeService.loadStatefulKnowledgeSession( sessionId, kbase, config, env);</em></p><p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} catch(Exception e) {</em></p><p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;System.out.println("Exception in loading the session"); </em></p><p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;sessionobj = JPAKnowledgeService.newStatefulKnowledgeSession( kbase, config, env );</em></p><p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}</em></p><p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}</em></p><p>&#160; </p><p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;new JPAWorkingMemoryDbLogger(sessionobj);</em></p><p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;KnowledgeRuntimeLoggerFactory.newConsoleLogger(sessionobj);</em></p><p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;JPAProcessInstanceDbLog processLog = new JPAProcessInstanceDbLog(sessionobj.getEnvironment());</em></p><p>&#160; </p><p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;DsrClientHandler wsHumanTaskHandler = new DsrClientHandler(sessionobj);</em></p><p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;wsHumanTaskHandler.setClient(client.getTaskClient());</em></p><p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;sessionobj.getWorkItemManager().registerWorkItemHandler("Human Task",wsHumanTaskHandler);</em></p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p>With this code, i can able to create the process instance successfully and i am completing the human task by using HornetQ service. It is sucessfully completing the human task and coming to the script task (i can see the syslogs in the script task get printed). >From the script task, i am calling my business implementation java class and calling signal event after the business logic completion.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I am signalling as below,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><em>&#160;&#160;&#160;&#160;&#160;&#160; StatefulKnowledgeSession ksession =&#160; util.getSession();</em></p><p><em>&#160;&#160;&#160;&#160;&#160;&#160; ksession.signalEvent(eventtype, null, Long.parseLong(processid));</em></p><p><em>&#160;&#160;&#160;&#160;&#160;&#160; //ksession.signalEvent(eventtype, null);</em></p><p><em>&#160;&#160;&#160;&#160;&#160;&#160; ProcessInstance processinst = ksession.getProcessInstance(Long.parseLong(processid));</em></p><p><em>&#160;&#160;&#160;&#160;&#160;&#160; //processinst.signalEvent(eventtype, null);</em></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>after this signalling, it is not coming to the next script task. I have developed my BPMN file by using eclipse (setup using JBPM 5.3 installer). </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I dont know what is really wrong with my code. I am not getting any exception after the signal event, but console is printing the following logs.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>2012-07-31 12:29:27,804 INFO&#160; [STDOUT] (Thread-26) BEFORE PROCESS NODE EXITED node:External Task1[id=4] process:Sample new DSR Process[id=IngestMetadataAndFile]</strong></p><p><strong>2012-07-31 12:29:27,805 INFO&#160; [STDOUT] (Thread-26) BEFORE PROCESS NODE TRIGGERED node:Signal[id=5] process:Sample new DSR Process[id=IngestMetadataAndFile]</strong></p><p><strong>2012-07-31 12:29:27,805 INFO&#160; [STDOUT] (Thread-26) AFTER PROCESS NODE TRIGGERED node:Signal[id=5] process:Sample new DSR Process[id=IngestMetadataAndFile]</strong></p><p><strong>2012-07-31 12:29:27,805 INFO&#160; [STDOUT] (Thread-26) AFTER PROCESS NODE TRIGGERED node:External Task1[id=4] process:Sample new DSR Process[id=IngestMetadataAndFile]</strong></p><p><strong>2012-07-31 12:29:27,805 INFO&#160; [STDOUT] (Thread-26) AFTER PROCESS NODE TRIGGERED node:External Task1[id=4] process:Sample new DSR Process[id=IngestMetadataAndFile]</strong></p><p><strong>2012-07-31 12:29:27,805 INFO&#160; [STDOUT] (Thread-26) AFTER PROCESS NODE TRIGGERED node:EnterMetadata[id=2] process:Sample new DSR Process[id=IngestMetadataAndFile]</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>can you please help me to get out of this issue, where i got stucked and invested lot of time <span> :( </span>. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Thanks,</p><p>Ravichandran</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/751377#751377">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>