<!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="http://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;">
Re: Process flow stops after human task completion in jBPM5.1
</h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/michal.warecki">MichaĆ Warecki</a> in <i>jBPM</i> - <a href="http://community.jboss.org/message/623320#623320">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>Yes, I register this handler. </p><p>Here is my configuration:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag"><bean id="systemEventListener"
        class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"></span>
        <span class="jive-xml-tag"><property name="staticMethod"></span>
            <span class="jive-xml-tag"><value></span>org.drools.SystemEventListenerFactory.getSystemEventListener<span class="jive-xml-tag"></value></span>
        <span class="jive-xml-tag"></property></span>
    <span class="jive-xml-tag"></bean></span>
    <span class="jive-xml-tag"><bean id="taskService" class="org.jbpm.task.service.TaskService"></span>
        <span class="jive-xml-tag"><constructor-arg ref="taskEntityManagerFactory" /></span>
        <span class="jive-xml-tag"><constructor-arg ref="systemEventListener" /></span>
    <span class="jive-xml-tag"></bean></span>
    <span class="jive-xml-tag"><bean id="taskSession" class="org.jbpm.task.service.TaskServiceSession"
        factory-bean="taskService" factory-method="createSession" scope="singleton" ></span>
    <span class="jive-xml-tag"></bean></span>
    <span class="jive-xml-tag"><bean id="taskExecutor"
        class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"></span>
        <span class="jive-xml-tag"><property name="corePoolSize" value="5" /></span>
        <span class="jive-xml-tag"><property name="maxPoolSize" value="10" /></span>
        <span class="jive-xml-tag"><property name="queueCapacity" value="25" /></span>
    <span class="jive-xml-tag"></bean></span>
    <span class="jive-xml-tag"><bean id="minaTaskServer" class="org.jbpm.task.service.mina.MinaTaskServer"></span>
        <span class="jive-xml-tag"><constructor-arg ref="taskService" /></span>
    <span class="jive-xml-tag"></bean></span>
    <span class="jive-xml-tag"><bean id="taskServerThread" class="pl.edu.wat.mw.task.server.TaskServer"
        p:taskExecutor-ref="taskExecutor" p:minaTaskServer-ref="minaTaskServer"
        init-method="startServer" destroy-method="stopServer" lazy-init="false" /></span>
    <span class="jive-xml-tag"><bean id="knowledgeSessionFactory" class="pl.edu.wat.mw.process.session.KnowledgeSessionFactory"
        p:entityManagerFactory-ref="processEntityManagerFactory"
        p:transactionManager-ref="transactionManager" /></span>
   
    <span class="jive-xml-tag"><bean id="knowledgeSession" class="org.drools.runtime.StatefulKnowledgeSession"
        factory-bean="knowledgeSessionFactory"
        factory-method="createSession"/></span>
    <span class="jive-xml-tag"><bean id="taskClientFactory" class="pl.edu.wat.mw.task.service.TaskClientFactory" /></span>
       
    <span class="jive-xml-tag"><bean id="taskClient" class="org.jbpm.task.service.TaskClient"
        factory-bean="taskClientFactory"
        factory-method="factory"
        scope="singleton"
        lazy-init="true"
    /></span>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Where in KnowledgeSessionFactory I have:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code jive-java"><font color="navy"><b>public</b></font> <font color="navy"><b>void</b></font> afterPropertiesSet() <font color="navy">{</font>
        KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
        kbuilder.add(ResourceFactory.newClassPathResource(<font color="red">"process/pl.edu.wat.mw.RetailSales.bpmn2"</font>), ResourceType.BPMN2);
        kbase = kbuilder.newKnowledgeBase();
       
        env = KnowledgeBaseFactory.newEnvironment();
        env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, entityManagerFactory);
        env.set(EnvironmentName.TRANSACTION_MANAGER, transactionManager);
    <font color="navy">}</font>
   
    <font color="navy"><b>public</b></font> StatefulKnowledgeSession createSession() <font color="navy">{</font>
        <font color="darkgreen">// create a new knowledge session that uses JPA to store the runtime state</font>
        StatefulKnowledgeSession ksession =
            JPAKnowledgeService.newStatefulKnowledgeSession(kbase, null, env);
       
        JPAWorkingMemoryDbLogger logger = <font color="navy"><b>new</b></font> JPAWorkingMemoryDbLogger(ksession);
       
        ksession.getWorkItemManager().registerWorkItemHandler(<font color="red">"Human Task"</font>, <font color="navy"><b>new</b></font> WSHumanTaskHandler());
        ksession.getWorkItemManager().registerWorkItemHandler(<font color="red">"WSInvoke"</font>, serviceInvokerWorkItem);
        ksession.getWorkItemManager().registerWorkItemHandler(<font color="red">"CreateOrderProfile"</font>, createOrderProfileWorkItem);
       
        logger.dispose();
        <font color="navy"><b>return</b></font> ksession;
    <font color="navy">}</font>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>In TaskClientFactory:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code jive-java"><font color="navy"><b>public</b></font> TaskClient factory() <font color="navy">{</font>
        TaskClient client = <font color="navy"><b>new</b></font> TaskClient(<font color="navy"><b>new</b></font> MinaTaskClientConnector(<font color="red">"default client"</font>, <font color="navy"><b>new</b></font> MinaTaskClientHandler(SystemEventListenerFactory.getSystemEventListener())));
        <font color="navy"><b>return</b></font> client;
    <font color="navy">}</font>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span class="short_text" id="result_box" lang="en"><span class="hps">I have a</span> <span class="hps">feeling that</span> <span class="hps">I broke</span> <span class="hps">something in Spring configuration :-)<br/></span></span></p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/623320#623320">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in jBPM at <a href="http://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>