<div dir="ltr"><div>On Fri, Nov 8, 2013 at 8:37 AM, darrell.pittman <span dir="ltr">&lt;<a href="mailto:darrell@darrellpittman.ca" target="_blank">darrell@darrellpittman.ca</a>&gt;</span> wrote:<br></div><div class="gmail_extra">
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hello,<br>
<br>
I am new to Drools a starting a new Java EE 6 application that will use<br>
drools.  We are not using Guvnor.  I am wondering what is the suggested way<br>
of creating the knowledge agent and where to cache it.  EJB&#39;s shouldn&#39;t read<br>
from the file system so I guess a Singleton EJB is out as far as loading the<br>
knowledgebase goes.  Should I load knowledgebase in a ServletContextListener<br>
and store it in the ServletContext and pass it into my EJB&#39;s?  What is the<br>
recommend practice?<br></blockquote><div><br></div><div>I faced the same problem.  There is surprisingly little information on how people do this.  The next issue you&#39;re going to face is when or if to serialize sessions (recreating them on every request is too expensive).  Then you&#39;re probably going to run into issues with how to get the KnowledgeBase if your KnowledgeAgent discovers a new one.<div>
<br></div><div>The &quot;correct&quot; way (Java EE-approved) to get the KnowledgeAgent working is to use it via a resource adapter, because KnowledgeAgent uses the filesystem and threads, both of which are no-nos in a Java EE environment.  It just so happens I wrote one a long time ago: <a href="https://github.com/ljnelson/drools-jca">https://github.com/ljnelson/drools-jca</a>  I can&#39;t vouch for whether it is entirely correct (JCA is a black art) but it worked for me.</div>
<div><br></div><div>Do let us know how you end up proceeding with your architecture.</div><div><br></div><div>Best,</div><div>Laird</div></div></div><div><br></div>-- <br><a href="http://about.me/lairdnelson" target="_blank">http://about.me/lairdnelson</a><br>

</div></div>