You sorta understood it, it was probably my description that was lacking :)
My application has two kinds of objects, Resident objects and Transient
objects.
1. Transient objects are per-request objects that will get asserted into
the rules engine. At the end of the request they go away
2. Resident objects are application scoped objects that get lazily loaded
into memory and live beyond the scope of each request
What I would "ideally" like to do is the following
- Create a RuleBase with no facts in it
- Create Sessions from said rule base
- Assert transient objects into memory, which may cause some resident
objects to be loaded
- Retract all transient objects from memory, but leave the resident objects
Now I could easily do that with 2 interfaces, ResidentObject and
TransientObject, and retract all transients after each fireAllRules(), but
that would also mean i need to use a single Session for the entire lifetime
of the application, right? What I would really like to do is to be able to
"seed" the RuleBase with initial facts that are visible from all sessions.
hope that made more sense
dave
On Mon, Oct 13, 2008 at 4:01 PM, Edson Tirelli <tirelli(a)post.com> wrote:
If I understood your question,
Drools 4 -> use "from" to load them on demand for your rules
Drools 5 -> you can do the same, or create a session, pre-load it and
serialize it to disk or an in-memory binary cache... now, for each request
from your application, instead of creating a new session, de-serialize the
session from your disk (or in-memory cache) and use it. Please note that you
are doing nothing more than clone-by-serialization for the preloaded
session, if you use this strategy.
[]s
Edson
2008/10/13 David Sinclair <dsinclair(a)chariotsolutions.com>
> I have a question concerning facts. I have a service based application
>
> XML IN -> Business Objects -> Rule Processing -> Business Objects -> XML
> OUT
>
> Pretty straightforward.
> In the rule processing I will lazily load objects into WorkingMemory that
> drive some of the business rules. For instance, if a new Windows
> Server(Business Object) is installed, ensure its OS is only Windows Server
> 2007 (lazily loaded DB object).
>
> What I would like to do is be able to either preload the working memory
> with this data, or preferably, lazily load the data. So my question is how
> do you place facts into working memory when you create a new session each
> time without having to assert them everytime? Or this that a stupid
> question...Should the question be, since working memory/sessions aren't
> thread safe, i.e. one can't be shared by everyone, what is the best way to
> place long lived facts into memory of all sessions?
>
> thanks
>
> dave
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
>
--
Edson Tirelli
JBoss Drools Core Development
JBoss, a division of Red Hat @
www.jboss.com
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users