It looks like not many people know about this, but Oracle actually has two business rule engines. One is called OBR (Oracle Business Rules) and it is bundled with SOA suite. The other one has less meaningful name OPA (Oracle Policy Automation) and at the first glace serves totally different purpose of generating a nice web questionnaire from a word doc with specs. Fortunately the company that originally developed OPA (RuleRust/Haley) was cleaver about decomposing functionality and Oracle inherited this cleaver design after purchasing Haley.
OPA consists of three parts:
- Determinations Engine – a library you can use in your .net or java program, does all the business logic evaluation
- Web Determinations – the part that runs the web surveys and uses the DE for making decisions
- Determinations Server – that’s the part that wraps the DE and exposes it in the form of a web service. Essentially it does the same thing OBR does.
The way OPA works is
- you write your business rules specs using more-or-less plain english in a word or excel document
- markup your rules with OPA toolbar (part of MS office only, sorry)
- compile your rules using the same OPA toolbar
- build a package containing rules from multiple source using Oracle Policy Modeling – a standalone tool, part of OPA package. Also windows only, also sorry.
- you upload the package to the application server
Since the package contains the DE all your business logic becomes a web service you can consume just like OBR.
This is all cool and in fact OPA works much faster than OBR in 98% of cases, supports bulk processing and overall awesome. But it’s not quite as friendly as OBR in terms of editing the business rules, right? BPM Workspace doesn’t see these rules and you can’t modify the rules in runtime.
Fortunately there is a way to make it more friendly. Here’s how…
Let’s make the rules hot-pluggable, meaning you can change them in runtime without redeploying and restarting the DE (this is the default behavior).
OPA works with multiple application servers, I’m using WebLogic in my projects. Unlike other application server Weblogic doesn’t explore .war when you install it. For this reason we need to deploy already exploded .war file. In your OPM directory and find the determinations-server.war file in your projects/
/Release directory. If you don’t see this file in OPM select Build->Build and Run->Run with Oracle Determinations Server->Run. In a few seconds the .war file will appear in the filesystem.
Unzip this .war file somewhere. If you don’t have a good zip archiver (like free 7zip) installed just change the file extension from .war to .zip. Windows 7 can handle this .zip file.
In the WEB-INF/classes/config directory of the exploded .war you will find application.properties file. OPA documentation mistakenly mentions configuration/ directory, hope they will correct this soon. In this file you need to change three things:
- rulebase.path=/some/place/on/the/app/server – this is a directory on the application server where you will keep all your rule files. Choose any, make sure the directory has ownership and permissions readable by the Application server
- load.rulebase.from.classpath=false. If you keep this true DS will ignore the rulebase.path, so make sure it is set to false
- cache.loaded.rulebases=false. If you keep this true you will need to restart the DS each time you upload new rules. Make sure it is set to false to enable runtime-pluggability of the rules.
Now copy this entire exploded .war file to the application server and use Weblogic Console to install the determinations server. Make sure you start it after installation.
With each ruleset you have compiled with OPM you can find it’s results of compilation in /projects/
/Release/determinations-server/WEB-INF/classes/rulebases directory. The ruleset is a single .zip file. Once you copy this file to the /some/place/on/the/app/server directory on your application server specified above this ruleset will get plugged to the DS immediately. You can verify this by querying ListRulebases service on the app server.
This post is published in How To, Other.