[rules-users] Stop Processing Rules

Ronald R. DiFrango ron.difrango at gmail.com
Fri Nov 16 09:04:30 EST 2007


Edson,

Thanks.  I knew there was a better way, I just did not know about it.

Ron

On Nov 15, 2007 5:15 PM, Edson Tirelli <tirelli at post.com> wrote:

>
>     Throwing exceptions in the consequence is not safe and not advisable.
>     To stop the rules engine you can use the following statement in your
> consequence:
>
> drools.halt();
>
>     Use a fact, a call back, or an attribute to identify the problem you
> detected.
>
>     []s
>     Edson
>
> 2007/11/15, Ronald R. DiFrango <ron.difrango at gmail.com>:
> >
> > All,
> >
> > I have a situation where I want the rules execution to stop processing
> > immediately when it encounters a situation like the following:
> >
> > rule "Invalid RTV Line"
> >     salience 100
> >
> >     when
> >         rtvDetailLine : DetailLine(detailRtvNumber:rtvNumber != null,
> > lineNumber != null )
> >         rtvHeader : RtvHeader( rtvNumber != detailRtvNumber )
> >     then
> >         logger.debug("Invalid RTV Line");
> >         throw new RuntimeException("Invalid RTV Line");
> > end
> >
> > Basically this is a parent child relationship and under some
> > circumstances the process that feeds data into the rules it corrupts this
> > relationship.  I want to stop the rules process immediately and do nothing
> > further.  As you see above, my first attempt is just throw a runtime
> > exception that is caught/ logged and report by the calling program.  Does
> > this seem like a reasonable approach or is there a better approach to do
> > this?
> >
> > Ron
> >
> > _______________________________________________
> > rules-users mailing list
> > rules-users at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
> >
>
>
> --
>   Edson Tirelli
>   Software Engineer - JBoss Rules Core Developer
>   Office: +55 11 3529-6000
>   Mobile: +55 11 9287-5646
>   JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20071116/4330765b/attachment.html 


More information about the rules-users mailing list