Hello,

I am using JBoss Rules to validate entities before storing them in the database. I therefore need a way to inform the calling code that the entity which was asserted failed verification. The only way I have been able to find that works is to assert an exception from within the rule file. For example:

rule "user is 'miked'"
  when
    identity : Identity( username == "miked" )
  then
    assertLogical(new IllegalStateException("Entity failed verification."));
end

Then in the Java that fires the rule, I have:

workingMemory.fireAllRules();
for(Iterator i = workingMemory.getObjects(Exception.class).iterator(); i.hasNext(); ) {
    System.out.println("Exception: "+i.next());
}

Which seems to be working OK. But I wanted to see if maybe there is a better way to accomplish what I need.

Thanks for you help.
Mike


--
*********************************
Mike Dougherty
858.232.3635

*********************************