[rules-users] Best approach for inserting facts into Drools

Matias matias.ordonez at globant.com
Mon Dec 14 14:31:45 EST 2009


Hi, this is my first time with Drools and I would really appreciate if
someone can give me some advice on the following:

Scenario:
* There is a list of objects 'A' which is updated periodically (initially
every 1 min.)
* In the meantime I would like to run a set of 40 rules on 'A' to modify a
second list 'B'.
* 'A' may contain more than a thousand objects (its size might grow up to a
few thousands or shrink on every update – i.e. its size is not constant on
each update).

My question to the list is: “What is the best approach I should follow to
insert facts into Drools, i.e. To populate and update the ksession data ?”
Please see my questions in more detail below as Q1, Q2 and Q3.

In other words, which one of the two following approaches is recommended ?

1) Insert every single item from 'A' and 'B' into the ksession.
    Q1: For the objects that changed inside, Do I need to notify Drools ? If
I do, I guess I'll need a fact-handler for each item on the list.

2) Insert the lists 'A' and 'B' in the session
   Q2: 'A' is actually a TreeMap<String, Object>. Would it be more
convenient to insert it as a list ?

Q3) In terms of performance, which of the 2 approaches above is the best –
or shall I definitely avoid one ?

Thanks,
Matias 
-- 
View this message in context: http://n3.nabble.com/Best-approach-for-inserting-facts-into-Drools-tp90473p90473.html
Sent from the Drools - User mailing list archive at Nabble.com.




More information about the rules-users mailing list