It’s actually not terribly difficult to pull off. The key things you’ll want to do are:
- Initialize and start the ResourceChangeNotifierService.
- Initialize but DO NOT start the ResourceChangeScanner service.
- Determine how you’re going to trigger your rescan.
- When your API (or listener, or whatever) receives the message to update the knowledgebase, call resourceChangeScanner.scan()
The only wrinkle I see is that you want to store the rulebase in the database. I’m not quite sure how you’d configure the changescanner to read from the database. Is a shared file system not viable?
Behalf Of Blythe, Marshall
Sent: Tuesday, September 29, 2009 11:21 AM
Subject: [rules-users] Push model for rule updates?
Has anyone successfully implemented a push model for updating rules in a Drools 5.0 application? Here’s what I’d like to do:
1. Rules will be authored out-of-process, and serialized KnowledgePackages will be stored in a database.
2. When the client application starts up (i.e. a regular servlet-based app) it will fetch the KnowledgePackages from the database and use them to configure a singleton KnowledgeBase instance.
3. A special UI in the client application will allow authorized users to upload new KnowledgePackages. When new packages are uploaded they are first persisted in the database and then used to update the KnowledgeBase at runtime. All subsequent calls to fireAllRules() should use the rules in the new package.
If anyone has done something like this before then I’d appreciate some advice on how to manage updates to the KnowledgeBase at runtime.
----------------------------------------- This e-mail and any attachments may contain CONFIDENTIAL information, including PROTECTED HEALTH INFORMATION. If you are not the intended recipient, any use or disclosure of this information is STRICTLY PROHIBITED; you are requested to delete this e-mail and any attachments, notify the sender immediately, and notify the LabCorp Privacy Officer at firstname.lastname@example.org or call (877) 23-HIPAA.