[rules-users] Where to cache KnowledgeAgent

Stephen Masters stephen.masters at me.com
Fri Nov 8 18:20:20 EST 2013


I avoid knowledge agents myself. It doesn’t take a lot of code to build a knowledge base, and I like to have a more deliberate ‘push’ of new/updated rules. When I'm not planning on changing rules, I just load them from the classpath. If I intend to change them at runtime, then I load them from a URL.

Steve


On 8 Nov 2013, at 16:51, Laird Nelson <ljnelson at gmail.com> wrote:

> On Fri, Nov 8, 2013 at 8:37 AM, darrell.pittman <darrell at darrellpittman.ca> wrote:
> Hello,
> 
> I am new to Drools a starting a new Java EE 6 application that will use
> drools.  We are not using Guvnor.  I am wondering what is the suggested way
> of creating the knowledge agent and where to cache it.  EJB's shouldn't read
> from the file system so I guess a Singleton EJB is out as far as loading the
> knowledgebase goes.  Should I load knowledgebase in a ServletContextListener
> and store it in the ServletContext and pass it into my EJB's?  What is the
> recommend practice?
> 
> I faced the same problem.  There is surprisingly little information on how people do this.  The next issue you're going to face is when or if to serialize sessions (recreating them on every request is too expensive).  Then you're probably going to run into issues with how to get the KnowledgeBase if your KnowledgeAgent discovers a new one.
> 
> The "correct" 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: https://github.com/ljnelson/drools-jca  I can't vouch for whether it is entirely correct (JCA is a black art) but it worked for me.
> 
> Do let us know how you end up proceeding with your architecture.
> 
> Best,
> Laird
> 
> -- 
> http://about.me/lairdnelson
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20131108/5a4f0d5a/attachment.html 


More information about the rules-users mailing list