[rules-users] Question on Drools migration from 3.0 to 5.1
Liqun Du
liqundu at aol.com
Thu Jun 23 09:19:16 EDT 2011
Hi All,
We have an issue in rule when migrating drools from 3.0 to 5.1 with "eval". To demo this error, I use the following code:
public class Info {
public String getItem(int i) {
return "item is " + i;
}
}
In Drools 3.0, the following rule is fine:
rule "test eval"
salience 1
when
info : Info()
eval(into.getItem(0) != null)
then
System.out.println("test eval");
end
But when using drools 5.1, it shows error "info can not be resolved". I found a way to resolve this issue but don't know this is the best practice.
declare Item
name : String
end
rule "insert item before eval"
salience 0
when
info : Info()
then
Item item = new Item();
item.setName(info.getItem(0));
insert( item );
end
rule "test eval"
salience 1
when
item : Item(n : name)
eval( n != null)
then
System.out.println("test eval");
end
BTW, using "declare" in rule may cause memory leaking? We are seeing heap size growing after migrated to 5.1.
Thanks,
Liqun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110623/09e8c655/attachment.html
More information about the rules-users
mailing list