Hi, re:Drools 4.0.3
I want/need to use ConsequenceExceptionHandler for exception handling. I'd like to be able to get the ConsequenceExceptionHandler from a StatefulSession. The only way I see to get the handler relies on InternalRuleBase. The JavaDoc at http://downloads.jboss.com/drools/docs/_ 4.0.3.15993.GA/apidocs/org/drools/common/InternalRuleBase.html does not have any annotation that it is internal use only. However the naming convention sure makes me this this is a bad idea. Any alternatives to the following code to retrieve the ConsequenceExceptionHandler? InternalRuleBase thisSmellsLikeABadIdea= (InternalRuleBase) wm.getRuleBase(); DroolsExceptionHandler deh = (DroolsExceptionHandler) thisSmellsLikeABadIdea.getConfiguration().getConsequenceExceptionHandler(); List<Exception> exceptions = deh.getExceptions(); (Where DroolsExceptionHandler is package droolsconfig; import java.util.ArrayList; import java.util.List; import org.drools.WorkingMemory; import org.drools.spi.Activation; import org.drools.spi.ConsequenceExceptionHandler; public class DroolsExceptionHandler implements ConsequenceExceptionHandler { List<Exception> exceptions = new ArrayList<Exception>(); public DroolsExceptionHandler() { } public void handleException(Activation activation, WorkingMemory workingMemory, Exception exception) { exceptions.add(exception); } public List<Exception> getExceptions() { return exceptions; } } ) _______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users