Rules Engine Service for Rules Based Routing and Long Runnin

Posted by Admin on 03-Mar-2008 13:58

Rules Engine Service for Rules Based Routing and Long Running Transaction Orchestration

?Business rules account for some of the most complex and frequently changing code

?Long running transactions are challenging to implement and manage

?This service demonstrates how a rules engine can be used to move the rules outside of code, and how making the engines memory persistent allows managing long running transactions

The service comes complete with a separate demo application that simulates the process of issuing a life insurance application:

1.Customer sends an application

2.The application must have a signed authorization form to allow the company to search person?s medical records

IF authorization form is missing THEN

Change app status to INCOMPLETE

Send letter to the customer asking to resubmit

ELSE

Change app status to VALIDATED

It may take the customer several days or even weeks to resubmit the app so it is a long running transaction! While we are waiting, the original application and the transaction context must be persisted and remain active.

3. The customer resubmits the app with a signed form. Now we can order a medical report from a medical information vendor. Some vendors have an online database and return results immediately, but others interview the applicant over the phone, may order some tests, etc. The medical report may take days or weeks to receive. That?s another long running transaction.

4. When the medical report arrives, it will have a list of medical conditions and a risk score.

IF risk > 500 THEN

Change app status to DELINED

Send DECLINE letter to the customer

ELSE

Change app status to APPROVED

Issue a Policy

This example shows that this process is full of business rules and long running transactions. One way to manage it is with a workflow system, another way is with a rules engine such as Drools. JBoss Drools is a powerful forward chaining engine that uses the efficient Rete algorithm modified to work with facts represented as Java objects.

The only drawback of the Drools engine is that the contents of its working memory are temporary and can not survive a system restart or a crash. Fortunately, Drools implements the Observer pattern and allows attaching a listener to the working memory. This service creates a special listener that keeps track of every object that is inserted, updated, or deleted, and makes a corresponding change in the database. Typically, an Oracle or MySQL database would be used, but this demo keeps things simple and uses an embedded HSQL pure Java database to avoid any need for administration and configuration. Making the working memory of the engine persistent allows managing long running transactions.

Typically rules are written using a combination of a special notation and Java. They are clearly externalized and easy to read to a Java developer but not to a business user. Fortunately, Drools allows defining a Domain Specific Language to express rules in natural language format. This demo demonstrates that capability as well.

Please Review

Thanks

RBRServiceAndDemoInsurance_3_3_2008.zip

Rules Based Routing and Long Running Transaction Orchestration Service.doc

All Replies

Posted by adaltas on 04-Mar-2008 11:22

Thank you! Your entry has been received and recorded and your rules copy moved.

This thread is closed