[rules-users] Externalizing Rule parameters - patterns/best practices

Mark Proctor mproctor at codehaus.org
Thu Dec 13 07:05:04 EST 2007


Krishna Satya wrote:
> 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.   
>
> My query is from my intent that application should be decoupled from 
> rules and the rules are decoupled from its parameters.
>
> 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.
>
> For example (Quick Psudo code, not sure if I have made any syntactical 
> errors):
>
> rule "Fee Waive Rule"
>     when
>          clientRequest : Request(account.balance > 2000 )
>     then
>           clientRequest.setFee(0);
> end
>
> rule "Fee Apply Rule"
>     when
>          clientRequest : Request(account.balance < 2000 )
>     then
>          clientRequest.setFee(5);
> end
>
> In the example above what are the best ways to externalize and make 
> available to the rule the account balance and fee parameters?
Create web based forms that generate the rules on save, use something 
like MVEL for rule generation. I also recommend you flatten your 
objects, using account.balance foeld a field constraint is not optimal.
>
> Any guidance on patterns/best practices/examples would be much 
> appreciated.
>
> Regards.
> - Krishna
>
>
>  
> ------------------------------------------------------------------------
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20071213/f504ec2d/attachment.html 


More information about the rules-users mailing list