<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18904">
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2 face=Arial>Miguel,</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>I think your work item handler should not be
throwing an exception, just because a java exception is low-level and linked to
one specific implementation and we try to keep the processes a little
higher-level.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>So what could you do then to model exceptional
situations when executing a work item? I suggest you use a try-catch block
to catch the java exception and translate that into something higher-level,
like:</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial> - your work item can contain result
parameters, in case of some failure you could fill in a special result parameter
with some data, the process instance can then map this result data to some
process variable which will allow you to use this data, for example in a XOR
split node immediate after this work item node to check for exceptional
situations, or in an on-exit action linked to the workItemNode (which could then
for example also throw a fault so that the nested exception handler mechanism
kicks in)</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial> - your work item handler could decide to send
a signal to the process instance to signal the occurrence of some exceptional
event, and you could use an event handler to listen to that event</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>Depending on your exact use case, I can probably
think of a few more alternatives (like using abortWorkItem instead of
completeWorkItem), but they might not be all ready to use
out-of-the-box.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>Kris</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV>----- Original Message ----- </DIV>
<BLOCKQUOTE
style="BORDER-LEFT: #000000 2px solid; PADDING-LEFT: 5px; PADDING-RIGHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px">
<DIV
style="FONT: 10pt arial; BACKGROUND: #e4e4e4; font-color: black"><B>From:</B>
<A title=mls.machado@gmail.com href="mailto:mls.machado@gmail.com">miguel
machado</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=rules-users@lists.jboss.org
href="mailto:rules-users@lists.jboss.org">Rules Users List</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Thursday, April 01, 2010 1:57
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [rules-users] How to do
Exception Handling???</DIV>
<DIV><BR></DIV><FONT size=2><FONT face=verdana,sans-serif>Hi,</FONT></FONT>
<DIV><FONT size=2><FONT face=verdana,sans-serif><BR></FONT></FONT></DIV>
<DIV><FONT size=2><FONT face=verdana,sans-serif>I'm not sure this will help
you out, but in what comes to the system i'm currently developing (using
drools expert), i've got this method "runRuleEngine" that collects facts and
fire rules on them and i am able to catch any sort of error within the drools
execution by surrounding that with try {} catch (Exception e)
{}. </FONT></FONT></DIV>
<DIV><FONT size=2><FONT face=verdana,sans-serif><BR></FONT></FONT></DIV>
<DIV><FONT size=2><FONT face=verdana,sans-serif>The important part is that it
took me a while to figure that out cuz eclipse didn't force me handle that, as
if the called method didn't have "throws" (it usually shows a compilation
error otherwise, right?).</FONT></FONT></DIV>
<DIV><FONT size=2><FONT face=verdana,sans-serif><BR></FONT></FONT></DIV>
<DIV><FONT size=2><FONT face=verdana,sans-serif>Just a
thought.</FONT></FONT></DIV>
<DIV><FONT size=2><FONT face=verdana,sans-serif>_ miguel</FONT></FONT></DIV>
<DIV><FONT size=2><FONT face=verdana,sans-serif><BR></FONT></FONT></DIV>
<DIV><FONT size=2><FONT face=verdana,sans-serif><BR></FONT></FONT><BR>
<DIV class=gmail_quote>On Wed, Mar 31, 2010 at 9:44 PM, nanic23 <SPAN
dir=ltr><<A
href="mailto:nanic23@hotmail.com">nanic23@hotmail.com</A>></SPAN>
wrote:<BR>
<BLOCKQUOTE
style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote><BR>I have a ruleflow that handles exceptions when they
are raised by a "Fault"<BR>node but I am not being able to accomplish the
same if an exception is<BR>thrown by a workItem or an action node
instead.<BR><BR>I have a workItem node with a work item handler that throws
a<BR>RuntimeException. My exception handler in the composite node is not
catching<BR>this exception.<BR><BR>So, question<BR>1) how can I handle
runtime exceptions thrown by my workItemHandlers?<BR>2) how can I get a hold
of the exception to log the stack trace?<BR><BR>Any ideas or tips are very
appreciated.<BR><BR>Nick.<BR><FONT color=#888888>--<BR>View this message in
context: <A
href="http://n3.nabble.com/How-to-do-Exception-Handling-tp689387p689387.html"
target=_blank>http://n3.nabble.com/How-to-do-Exception-Handling-tp689387p689387.html</A><BR>Sent
from the Drools - User mailing list archive at
Nabble.com.<BR>_______________________________________________<BR>rules-users
mailing list<BR><A
href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR><A
href="https://lists.jboss.org/mailman/listinfo/rules-users"
target=_blank>https://lists.jboss.org/mailman/listinfo/rules-users</A><BR></FONT></BLOCKQUOTE></DIV><BR><BR
clear=all><BR>-- <BR>"To understand what is recursion you must first
understand recursion"<BR></DIV>
<P>
<HR>
<P></P>_______________________________________________<BR>rules-users mailing
list<BR>rules-users@lists.jboss.org<BR>https://lists.jboss.org/mailman/listinfo/rules-users<BR></BLOCKQUOTE><br>
<FONT FACE=3D"Helvetica" SIZE=3D2>Disclaimer: <A HREF="http://www.kuleuven.be/cwis/email_disclaimer.htm">http://www.kuleuven.be/cwis/email_disclaimer.htm</A> for more information.</FONT>
<BR>
</BODY></HTML>