Using Drools to provide error processing and consequence management
        Posted  
        
            by Mike 
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Mike 
        
        
        
        Published on 2010-05-07T08:32:17Z
        Indexed on 
            2010/05/07
            8:38 UTC
        
        
        Read the original article
        Hit count: 269
        
drools
Hi, I am working on a module whose purpose is to process Java exceptions and decide upon a strategy for dealing with them. The exceptions could be things I know about (explicit business exceptions eg TransformationException) or more general environmental stuff (JMS errors, IO errors etc)
The facts inserted into the knowledge base are all the same class, and wrap (contain) an Exception.
I want to write a rule that will explicitly match the exceptions I know how to deal with (eg TransformationException) and have another rule that catches 'everything else'
The problem seems to me to be that for a fact containing a TransformationException, both rules will fire and the output will be uncertain.
How would I go about writing such exclusive rules without relying on salience to steer the order of execution (this seems to be bad practice from what I have read)?
I have a solution in place that I am not happy with whereby the outcome depends on the order in which the rules are defined in my .drl.
© Stack Overflow or respective owner