[rules-users] Firing Rules from DB (Dynamic Rules)

hanumesh.m hanumesh.m at gmail.com
Wed Apr 2 02:59:10 EDT 2008


Hi,

  As rules may keep on changing, I am using database to store the datails of
a rule. Say in table Transaction (ruleName, fileMask, fromQ, ToQ,transType).
An admin application may keep on adding/editing these rules as and when
required.

  I have a mule application, where in a mule Component will poll a specific
directory for a file. The file name will follow certain guidelines so that,
I can check the fileName against the fileMask in the database(Transaction
table. Assume there are rows as follows: 

'Rule ABC', 'ABC-834','ABC-834-edi','ABC-834.xml','834'  (indicates when
fileName has mask 'ABC-834' then the fromQueue for it is 'ABC-834.edi' and
toQueue is 'ABC-834.xml' 

'Rule XYZ', 'XYZ-834','XYZ-834.edi','XYZ-834.xml','834'

'Rule JIM', 'JIM-850','JIM-850.edi','JIM-850.xml','850'   so fileMask's r
('ABC-834','XYZ-834','JIM-850')


  The rules check will be in the .drl file, which will check the fileName
against each row(a bean repr. of eachrow) of the database and when ever
finds the match, obtains the fromQ and toQ of that matching row and updates
the fact object Message.

  Further activities of the Mule Component makes use of updated values(by
rules Engine) of Message object to decide on the target queues for the
content of the file.

  I have issues in implementing this and unable to fire the rules
successfully. Here I am facing issues of using the two objects in
WorkingMemory (Message and RuleVO-representing a rows information of DB)

 If anyone has worked in similar areas please help me out in solving this
problem. I am uploading the files Bean(Message,TransactionVO), Business
object(commonBO) (using applyRule() method), drl(Test.drl, and hardcoded
working version of Test_old.drl file )

 In Mule UMO Component I will call commonBo's applyRule();
/// here is the code in Mule Component

       cbo = new CommonBO();
       
LoadContextPath.setEdiFileName((String)msg.getProperty("originalFilename"));
        cbo.applyRule();
  
Thanks in advance,
Hanumesh M
http://www.nabble.com/file/p16443580/DynRules.zip DynRules.zip 
-- 
View this message in context: http://www.nabble.com/Firing-Rules-from-DB-%28Dynamic-Rules%29-tp16443580p16443580.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list