[rules-users] Can I insert a fact from within a drl function?

Shur, Bob robert.shur at hp.com
Tue Feb 7 16:19:48 EST 2012


It seems I am unable to insert a new fact from within a drl function. I tried this:

////////////////////////
package com.sample

declare Dummy
end

function void init() {
	insert(new Dummy()); // Doesn't compile
}

rule "init"
salience 999
when
then
	init();
	insert(new Dummy()); // Compiles
end

////////////////////////

Is the above supposed to work?




More information about the rules-users mailing list