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]

Reply via email to