[rules-users] Simple rulebase not behaving as expected : Part 2
Dean Jones
dean.m.jones at gmail.com
Thu Aug 23 04:06:45 EDT 2007
Hello again,
I'm probably missing something fundamental here, but I have the
following rulebase:
package org.drools.examples
rule "Hello World"
when
Integer()
then
System.out.println("Hello world");
end
rule "Goodbye World"
when
not Integer()
then
System.out.println("Goodbye cruel world");
end
and the following code:
public class TestReadRuleFile {
public static void main(String[] args) throws Exception {
PackageBuilder builder = new PackageBuilder();
InputStreamReader is = new InputStreamReader(
TestReadRuleFile.class.getResourceAsStream("test.drl"));
builder.addPackageFromDrl(is);
Package pkg = builder.getPackage();
RuleBase jbossRulebase = RuleBaseFactory.newRuleBase();
jbossRulebase.addPackage(pkg);
StatelessSession session = jbossRulebase.newStatelessSession();
session.execute(new Float(1));
}
}
Neither of the rules fire, which is not what I expected - I thought
that the "Goodbye world" rule would fire. When I switch to using a
StatefulSession, the rules behave as I expect. Any thoughts on what's
going on here? Thanks,
Dean.
More information about the rules-users
mailing list