Build, Test, Deploy

The downloaded workspace “openrules.dm.models” includes various examples of decision models that you can build, test, and deploy. They provide good prototypes for your own  operational decision models.

Build and Test Decision Models

To build a decision model you may simply double-click on the file “build.bat“. It will automatically transform all Excel tables to Java packages placed in the folder “generated” (or as defined in the setting.bat). Nobody ever should modify the generated files. You even don’t have to look at them – they are simply being used by the DM to execute the decision models when you double-click on “run.bat“.  OpenRules DM keeps track to the original Excel tables, and produces all messages and explanations in the business terms used in Excel. When you execute the decision model, along with a user-friendly execution protocol, OpenRules DM produces the same explanation reports in the HTML format as the classic OpenRules BRDMS does – see the generated folder “report”.

Some decision models (e.g. HelloJava) use data instances created not in Excel but using the existing Java classes. In such cases, you can build the model using the provided batch file “buildJava.bat” and execute it using “runJava.bat”.

Integration with IT

This release comes with a new, very simple Java API for invocation of OpenRules decision models from your Java applications. It uses two new Java classes “DecisionModel” and “Goal” that support the Goal-Oriented Decision Modeling approach described in this book (that has been updated as well). The provided Java launchers demonstrate how to execute decision models against real data instances. Here is what you usually should do:

    • Create an instance of the class DecisionModel using the automatically generated Java class (which name is defined in settings.bat as MODEL_NAME), e.g.
      DecisionModel model = new DecisionModelVacationDays();
    • Ask the model to create an instance of the class Goal, e.g.
      Goal goal = model.createGoal(“Vacations Days”);
    • Ask the goal to use your own business objects, e.g.
      goal.use(“Employee”,employee);
    • Execute the goal using the standard Goal’s method
      goal.execute();

Here is an example of how the decision model “Vacation Days” can be invoked using Launcher.java:

It will calculate the number of vacation days for the employee Mary Grant. Of course, an employee may come from a database, from your UI or from JSON.

Deployment

By converting you decision models to highly efficient Java code, the DM allows you to deploy them as regular Java programs in the way you prefer:

    • locally by using a simple Java API
    • on any server like Apache Tomcat or IBM WebSphere
    • on cloud as a decision microservice utilizing any serverless architecture provided by any major cloud vendors such as Amazon, Google, Microsoft, IBM or Oracle.