<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3132" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=034541815-12122007><FONT face=Arial
color=#0000ff size=2>Ultimately I guess the decision is yours, as you possess
the domain knowledge.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=034541815-12122007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=034541815-12122007><FONT face=Arial
color=#0000ff size=2>In your example, if the amount 2000 is static you could
externalise this into a global; if however it is dependant upon another domain
entity (ClientType for example) you might introduce it as another
Fact.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=034541815-12122007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=034541815-12122007><FONT face=Arial
color=#0000ff size=2>You could also look into externalising by using the "from"
keyword (although the result needs to be static as the rule engine
cranks).</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=034541815-12122007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=034541815-12122007><FONT face=Arial
color=#0000ff size=2>My preference, if the parameters are static, would be
for the use of globals read by the service tier and put into the
WM.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=034541815-12122007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=034541815-12122007><FONT face=Arial
color=#0000ff size=2>With kind regards,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=034541815-12122007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=034541815-12122007><FONT face=Arial
color=#0000ff size=2>Mike</FONT></SPAN></DIV><BR>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] <B>On Behalf Of </B>Krishna
Satya<BR><B>Sent:</B> 12 December 2007 15:10<BR><B>To:</B>
rules-users@lists.jboss.org<BR><B>Subject:</B> [rules-users] Externalizing
Rule parameters - patterns/bestpractices<BR></FONT><BR></DIV>
<DIV></DIV>Hi, I am a new user to Drools and having passed the first few days
of reading and experimenting with the tool I am now looking to see how rule
parameters can be externalized. And along those lines looking for
patterns and best practices. I have searched through the user forums
(maybe not submitting the right search critera) and through
samples etc. <BR><BR>My query is from my intent
that application should be decoupled from rules and the rules are
decoupled from its parameters.<BR><BR>I am wondering if Decision
tables is the recommended approach or externalizing/sourcing from Db
recommended. Does the Business Service that interacts with the rule
engine source the rule parameters and push it into working memory for the rule
to pickup...or should the rule
declaration be tightly coupled to its parameters.
<BR><BR>For example (Quick Psudo code, not sure if I have made any syntactical
errors):<BR><BR>rule "Fee Waive
Rule"<BR> when<BR> clientRequest
: Request(account.balance > 2000
)<BR> then<BR>
clientRequest.setFee(0);<BR>end<BR><BR>rule "Fee Apply
Rule"<BR> when<BR> clientRequest
: Request(account.balance < 2000
)<BR> then<BR> clientRequest.setFee(5);<BR>end<BR><BR>In
the example above what are the best ways to externalize and make available to
the rule the account balance and fee parameters? <BR><BR>Any guidance on
patterns/best practices/examples would be much
appreciated.<BR><BR>Regards.<BR>- Krishna<BR><BR><BR>
</BLOCKQUOTE></BODY></HTML>