views:

364

answers:

1

I am doing ksession.insert(list) and after that I have to fire rule 1 in the drl file, then ksession.insert(list) and fire rule 2 in the drl.

Could someone tell me how to achieve this. I read about agenda filters and facthandles but do not really know how to get this to work

Below is some code:

ArrayList list = new ArrayList(); list.add(product1); list.add(product2); list.add(product3);

ksession.insert(list);
ksession.fireAllRules("fire rule 1 in drl");

//remove list?

ArrayList list2 = new ArrayList(); list2.add(str1); list2.add(str2); list2.add(str3);

ksession.insert(list2); ksession.fireAllRules("fire rule 2 in drl");

A: 

You don't directly control what rules fire - the constraints on the rules determine this. Filters can only help if you are stopping rules from firing.

Michael Neale