Re: [rules-users] Rookie question: best place to locate KnowledgeBase in web application?

2009-11-02 Thread ljnelson


ljnelson wrote:
 
 My question is: where is the best place to put the various parts, and what
 sort of synchronization do I need to worry about?  I did not see any
 reference to these issues in the (massive, otherwise excellent) Drools
 documentation.
 

Well, OK, that generated a lot of traffic.  :-)

Talking to myself here, let's expand this out a bit and say: OK, how would
we do this inside a stateless session bean?  I am loathe to write a resource
adapter for Drools.

Given that, and that I'm working with stateless sessions exclusively, I'm
also willing to live with several instances of Drools--i.e. if I create the
engine as an instance variable (or static variable) inside my SLSB, I'm
willing to live with the fact that the container might (probably will)
create several instances of my SLSB, and hence several instances of my rules
engine--they'll all be reading the same rules information so should vend the
same results.

My main question, for the two of you still reading, is around
synchronization: I understand that a StatelessKnowledgeSession is thread
safe, but what about acquiring it?  Where else, if anywhere, will I run into
threading issues?

Thanks,
Laird
-- 
View this message in context: 
http://old.nabble.com/Rookie-question%3A-best-place-to-locate-KnowledgeBase-in-web-application--tp26152111p26157126.html
Sent from the drools - user mailing list archive at Nabble.com.

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Rookie question: best place to locate KnowledgeBase in web application?

2009-11-02 Thread Steve Ronderos
Hi Laird,

In our web application we create one KnowledgeAgent and each session calls 
 getKnowledgeBase to get the KnowledgeBase and then getStatelessSession to 
get a session.  We have not had any threading issues.  I'm pretty sure 
that each of those operations are thread-safe.

Hope this helps,
Steve

rules-users-boun...@lists.jboss.org wrote on 11/02/2009 09:13:01 AM:

 [image removed] 
 
 Re: [rules-users] Rookie question: best place to locate 
 KnowledgeBase in web application?
 
 ljnelson 
 
 to:
 
 rules-users
 
 11/02/2009 09:16 AM
 
 Sent by:
 
 rules-users-boun...@lists.jboss.org
 
 Please respond to Rules Users List
 
 
 
 ljnelson wrote:
  
  My question is: where is the best place to put the various parts, and 
what
  sort of synchronization do I need to worry about?  I did not see any
  reference to these issues in the (massive, otherwise excellent) Drools
  documentation.
  
 
 Well, OK, that generated a lot of traffic.  :-)
 
 Talking to myself here, let's expand this out a bit and say: OK, how 
would
 we do this inside a stateless session bean?  I am loathe to write a 
resource
 adapter for Drools.
 
 Given that, and that I'm working with stateless sessions exclusively, 
I'm
 also willing to live with several instances of Drools--i.e. if I create 
the
 engine as an instance variable (or static variable) inside my SLSB, I'm
 willing to live with the fact that the container might (probably will)
 create several instances of my SLSB, and hence several instances of my 
rules
 engine--they'll all be reading the same rules information so should vend 
the
 same results.
 
 My main question, for the two of you still reading, is around
 synchronization: I understand that a StatelessKnowledgeSession is thread
 safe, but what about acquiring it?  Where else, if anywhere, will I run 
into
 threading issues?
 
 Thanks,
 Laird
 -- 
 View this message in context: http://old.nabble.com/Rookie-question%
 3A-best-place-to-locate-KnowledgeBase-in-web-application--
 tp26152111p26157126.html
 Sent from the drools - user mailing list archive at Nabble.com.
 
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Rookie question: best place to locate KnowledgeBase in web application?

2009-11-02 Thread Greg Barton
I believe acquiring a StatelessKnowledgeSession is thread safe as well.

Many members of the drools dev team are traveling at the moment, hence the slow 
response.

--- On Mon, 11/2/09, ljnelson ljnel...@gmail.com wrote:

 From: ljnelson ljnel...@gmail.com
 Subject: Re: [rules-users] Rookie question: best place to locate 
 KnowledgeBase in web application?
 To: rules-users@lists.jboss.org
 Date: Monday, November 2, 2009, 9:13 AM
 
 
 ljnelson wrote:
  
  My question is: where is the best place to put the
 various parts, and what
  sort of synchronization do I need to worry
 about?  I did not see any
  reference to these issues in the (massive, otherwise
 excellent) Drools
  documentation.
  
 
 Well, OK, that generated a lot of traffic.  :-)
 
 Talking to myself here, let's expand this out a bit and
 say: OK, how would
 we do this inside a stateless session bean?  I am
 loathe to write a resource
 adapter for Drools.
 
 Given that, and that I'm working with stateless sessions
 exclusively, I'm
 also willing to live with several instances of Drools--i.e.
 if I create the
 engine as an instance variable (or static variable) inside
 my SLSB, I'm
 willing to live with the fact that the container might
 (probably will)
 create several instances of my SLSB, and hence several
 instances of my rules
 engine--they'll all be reading the same rules information
 so should vend the
 same results.
 
 My main question, for the two of you still reading, is
 around
 synchronization: I understand that a
 StatelessKnowledgeSession is thread
 safe, but what about acquiring it?  Where else, if
 anywhere, will I run into
 threading issues?
 
 Thanks,
 Laird
 -- 
 View this message in context: 
 http://old.nabble.com/Rookie-question%3A-best-place-to-locate-KnowledgeBase-in-web-application--tp26152111p26157126.html
 Sent from the drools - user mailing list archive at
 Nabble.com.
 
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users
 


  

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Rookie question: best place to locate KnowledgeBase in web application?

2009-11-01 Thread Laird Nelson
I'm going to be interacting with a KnowledgeBase in a web application.  I do
not expect the rules to change during the running of the application.  I
will be using StatelessKnowledgeSessions exclusively.

My question is: where is the best place to put the various parts, and what
sort of synchronization do I need to worry about?  I did not see any
reference to these issues in the (massive, otherwise excellent) Drools
documentation.

I assume that the best strategy is to:

   - Locate the KnowledgeBase in the ServletContext upon startup
   - Read in the rule base at startup in a synchronized block (I don't think
   the servlet specification guarantees that a ServletContextListener is
   thread-safe at startup, but maybe this is overkill)
   - During runtime, synchronize on the rule base while acquiring a
   StatelessKnowledgeSession from the ServletContext
   - Use the acquired StatelessKnowledgeSession freely, without any further
   concern for locking (after all, it's stateless, right?)

Could someone please correct me if any of these statements is wrong?

Thanks,
Laird
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users