<!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;">
    Confused about JBPM and knowledge agents
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/ckuharski">Charlie Kuharski</a> in <i>jBPM Development</i> - <a href="https://community.jboss.org/message/743791#743791">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>I'm new to this and I'm pretty much confused.&#160; I'm missing some basic concepts.</p><p>I'm trying to interact with the JBPM server at the API level via a proxy.&#160; I don't want the proxy to become the JBPM server.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>1) The code below works:</p><p>// code snippet</p><p class="line" id="LC65" style="padding: 0 0 0 10px;"> <span class="nd">@Test</span></p><p class="line" id="LC66" style="padding: 0 0 0 10px;">&#160;&#160;&#160; <span class="kd" style="font-weight: bold;">public</span> <span class="kt" style="color: #445588; font-weight: bold;">void</span> <span class="nf" style="color: #990000; font-weight: bold;">simpleExecution</span><span class="o" style="font-weight: bold;">()</span> <span class="o" style="font-weight: bold;">{</span></p><p class="line" id="LC67" style="padding: 0 0 0 10px;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="n">ProcessInstance</span> <span class="n">processInstance</span> <span class="o" style="font-weight: bold;">=</span> <span class="n">ksession</span><span class="o" style="font-weight: bold;">.</span><span class="na" style="color: #008080;">startProcess</span><span class="o" style="font-weight: bold;">(</span><span class="s" style="color: #dd1144;">"org.jbpm.test"</span><span class="o" style="font-weight: bold;">);</span></p><p class="line" id="LC68" style="padding: 0 0 0 10px;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="kt" style="color: #445588; font-weight: bold;">long</span> <span class="n">processInstance1Id</span> <span class="o" style="font-weight: bold;">=</span> <span class="n">processInstance</span><span class="o" style="font-weight: bold;">.</span><span class="na" style="color: #008080;">getId</span><span class="o" style="font-weight: bold;">();</span></p><p class="line" id="LC69" style="padding: 0 0 0 10px;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="n">Assert</span><span class="o" style="font-weight: bold;">.</span><span class="na" style="color: #008080;">assertEquals</span><span class="o" style="font-weight: bold;">(</span><span class="n">ProcessInstance</span><span class="o" style="font-weight: bold;">.</span><span class="na" style="color: #008080;">STATE_ACTIVE</span><span class="o" style="font-weight: bold;">,</span> <span class="n">processInstance</span><span class="o" style="font-weight: bold;">.</span><span class="na" style="color: #008080;">getState</span><span class="o" style="font-weight: bold;">());</span></p><p class="line" id="LC70" style="padding: 0 0 0 10px;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="n">ksession</span><span class="o" style="font-weight: bold;">.</span><span class="na" style="color: #008080;">signalEvent</span><span class="o" style="font-weight: bold;">(</span><span class="s" style="color: #dd1144;">"continueSignal"</span><span class="o" style="font-weight: bold;">,</span> <span class="kc" style="font-weight: bold;">null</span><span class="o" style="font-weight: bold;">,</span> <span class="n">processInstance1Id</span><span class="o" style="font-weight: bold;">);</span></p><p class="line" id="LC71" style="padding: 0 0 0 10px;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="n">Assert</span><span class="o" style="font-weight: bold;">.</span><span class="na" style="color: #008080;">assertEquals</span><span class="o" style="font-weight: bold;">(</span><span class="n">ProcessInstance</span><span class="o" style="font-weight: bold;">.</span><span class="na" style="color: #008080;">STATE_COMPLETED</span><span class="o" style="font-weight: bold;">,</span> <span class="n">processInstance</span><span class="o" style="font-weight: bold;">.</span><span class="na" style="color: #008080;">getState</span><span class="o" style="font-weight: bold;">());</span></p><p class="line" id="LC72" style="padding: 0 0 0 10px;">&#160;&#160;&#160; <span class="o" style="font-weight: bold;">}</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 style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>1) I'm trying to integrate with an existing application and the consultants ( I believe them) have a project that does the same basic steps but needs persistence.xml local to the project in addition to the persistence.xml on the server.</p><p>/*</p><p>&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160; * Create EntityManagerFactory and register it in the environment Create the</p><p>&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160; * knowledge session that uses JPA to persists runtime state</p><p>&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160; */</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;public static StatefulKnowledgeSession createSession() throws Exception {</p><p>&#160; </p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;KnowledgeBase kbase = readKnowledgeBase("SimpleHTForm.bpmn2");</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; emf = Persistence.createEntityManagerFactory( "org.jbpm.persistence.jpa" );</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; Environment env = KnowledgeBaseFactory.newEnvironment();</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf );</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; env.set( EnvironmentName.TRANSACTION_MANAGER, TransactionManagerServices.getTransactionManager() );</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; env.set( EnvironmentName.GLOBALS, new MapGlobalResolver() );</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; Properties properties = new Properties();</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; properties.put("drools.processInstanceManagerFactory", "org.jbpm.persistence.processinstance.JPAProcessInstanceManagerFactory");</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; properties.put("drools.processSignalManagerFactory", "org.jbpm.persistence.processinstance.JPASignalManagerFactory");</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; KnowledgeSessionConfiguration config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(properties);</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; return JPAKnowledgeService.newStatefulKnowledgeSession(kbase, config, env);</p><p>&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#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>What is this actually doing?&#160; Is this persisting around te JBPM server?&#160; Is the proxy becoming its own JBPM server?&#160; An I really interacting with JBPM or just using the classes locally and saving to the datasource?&#160; See the test example above.&#160; There is no server running for the test.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I've played with the demos and that makes sense.&#160; Interacting with an existing JBPM is very confusing.</p><p>Any direction would be greatly appreciated.</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/743791#743791">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in jBPM Development at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2035">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>