[rules-users] Is there a faster way of doing this in Drools ?

Davide Sottara dsotty at gmail.com
Wed May 9 08:24:22 EDT 2012


Could you please provide a more detailed example?
The usecase you propose is really interesting and the optimization of
something very similar is on the todo-list (@salaboy: "request-when" rings a
bell?)
Now, depending on your exact requirements, there could be various options,
more or less "clean" ;)

First of all, we should determine whether a) you need a new rule or b) you
can just use a parametric rule and carry the parameters in a fact, e.g.:

when
ParamHolder( $x : threshold, $bid : beanId )
Bean( id == $bid, value > $x )
then
...
end

If you do need new rules, generating the drl on the fly is feasible but the
parsing and compilation is a bit expensive, so maybe one should try to build
the internal representation, to save at least the parsing process and "jump"
to the RETE construction. Btw, you mentioned that you'd have to generate a
rule for each transaction: would that rule "lifecycle" be limited to the
transaction too? i.e. would it be possible/necessary to remove the rule once
it has been used?

Davide

--
View this message in context: http://drools.46999.n3.nabble.com/Is-there-a-faster-way-of-doing-this-in-Drools-tp3973888p3973949.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list