I have generated the alerts using the drools , i had created the drool files from database.Every time i am loading the
.drl file from resource folder in the project because of this one i am doing lot of io operation.
I want overcome from this problem , any way is there to load drool file from
in-memory same as cashing?
That's Drools 5? Time to upgrade. But you just use the same steps as I've provided them using code for Drools 6; the class names have changed somewhat. You do this once:
KieBase kieBase = ...; FileOutputStream fos1 = new FileOutputStream( OUTPATH ); ObjectOutputStream oos1 = new ObjectOutputStream( fos1 ); oos1.writeObject( kieBase ); oos1.close();
You do this for each run:
FileInputStream fis9 = new FileInputStream( OUTPATH ); ObjectInputStream ois9 = new ObjectInputStream( fis9 ); KieBase kieBase1 = (KieBase)ois9.readObject(); KieSession kieSession = kieBase1.newKieSession();