[rules-users] Rookie question: best place to locate KnowledgeBase in web application?
Laird Nelson
ljnelson at gmail.com
Sun Nov 1 10:44:56 EST 2009
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20091101/d5f73f5f/attachment.html
More information about the rules-users
mailing list