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.