Felipe & Amitesh, I'm not sure about all of this thought about a secondary ear file. What's wrong with the following alternatives:
1) Storing the DRL files in a database 2) Using a property file or a JNDI resource to identify the location of the DRL file The DRL has to be loaded whereever you put it, so it really shouldn't matter. Just treat the DRL as a resource, it shouldn't matter where it resides so long as you can get a handle to it. That's how I have handled the rule loads from the drl in my application. When I have to modify rules, I simply deliver a single rule file to the target location and fire an http request to reload the rules. Other than that, I agree that caching the rulebase within the application can be beneficial. Why use a sledge hammer when a mallet will do? - Dave -----Original Message----- From: Felipe Piccolini [mailto:[EMAIL PROTECTED] Sent: Thursday, December 15, 2005 1:40 PM To: Sinha, Amitesh Cc: [email protected] Subject: Re: [drools-user] Keeping the drl files outside the J2EE .ear Amitesh, To do that I created another ear with the rules. As Im using weblogic I added a startUp class with a postStart() method to be activated on deployment via weblogic listeners. Inside the rule's ear I added an EJB so when it starts load the rules from .drl files, then bind the RuleBase into JNDI and then create an EJB instance to publish that RuleBase. In my business application I have a class that receives the facts and get the RuleBase from the EJB and creates a new WorkingMemory for that thread. In this way, when I need to change the rules, I just redeploy the ear with rule files and it automagicaly rebind the RuleBase on the JNDI and restart the EJB. The only thing you have to take care is to add a jar with all the object model classes from the business application inside the rule's ear because it needs to compile the rules to build the RuleBase. The first InitialContext and JNDI bind is slow, so the first EJB call, but I try to keep the RuleBase cached on the business application to make it faster for later fireAllRules(). When a new rule's ear is deployed you need to inform in some way that the RuleBase has changed to the business application so the application lookup the EJB again. This cache is not necesary because the call of the EJB between ears is fast enough. The EJB must be binded in JNDI too :) Good Luck!. Thursday, December 15, 2005, 4:35:21 PM, you wrote: > We are creating a business rule engine in J2EE framewrok using drools. > We would like to put the drl files outside the ear, so that we do not > have to build the .ear everytime we add a new drl file. How can this > be done? How will be the rules read/loaded from this external drl file? -------------------------- Felipe Piccolini [EMAIL PROTECTED]
