Over a million developers have joined DZone.

Red Hat JBoss BRMS - Adding a Declarative Data Model to the Customer Evaluation Demo

DZone's Guide to

Red Hat JBoss BRMS - Adding a Declarative Data Model to the Customer Evaluation Demo

· Java Zone
Free Resource

Download Microservices for Java Developers: A hands-on introduction to frameworks and containers. Brought to you in partnership with Red Hat.

Previously I posted a demo of Business Process Management (BPM) integration with rules, using the JBoss Business Rules Management System (BRMS) product. This demo provided a look at both the developers JBoss Developer Studio (JBDS) IDE project and then the business user side with the project also in the Business Rules Manager (BRM) web tooling.

The data model at that time was built using JBDS and is nothing more than Java objects, a Person object and a Request object to be precise. These are then put into a single Java archive (jar) file and importing into the BRM project. 
Declarative models
Many customers are interested in using the declarative data model, which is the data model hosted in your rules repository. You will not create Java object classes, instead you create your model using the BRM tooling guided editor.
Our declarative model in knowledge base.
Using a declarative model has some benefits:
  • it reinforces that the model belongs to the knowledge base and not to the application.
  • the model lifecycle is separate from your applications.
  • your Java types can be enriched with rule specific annotations.
  • when using imported Java archive (jar) files, they must be kept synchronized between the rules and the applications that use them, a declarative model does not.
Using the declarative model example project
The Quick Start documentation covers how to use the project to demonstrate the declarative model, but for ease of getting started:
You server log should play out something a lot like this:
16:49:24,047 INFO  [stdout] (http-/ starting new transaction
16:49:26,555 INFO  [stdout] (http-/ Entering Initialize Node
16:49:26,556 INFO  [stdout] (http-/ There as no evaluation objects defined, adding default ones for demo purposes.
16:49:26,562 INFO  [stdout] (http-/ Leaving Initialize Node
16:49:26,565 INFO  [stdout] (http-/ Gateway: Qualify Age
16:49:26,565 INFO  [stdout] (http-/ Gateway: Qualify Age
16:49:26,567 INFO  [stdout] (http-/ Entering Adult Customer Node
16:49:26,568 INFO  [stdout] (http-/ Detected and reporting valid request
16:49:26,569 INFO  [stdout] (http-/ Set validRequest to: true
16:49:26,573 INFO  [stdout] (http-/ Leaving Adult Customer Node
16:49:26,573 INFO  [stdout] (http-/ Entering Finance Rules Node
16:49:26,585 INFO  [stdout] (http-/ Leaving Finance Rules Node.
16:49:26,585 INFO  [stdout] (http-/ Gateway: Decide Financial Status
16:49:26,585 INFO  [stdout] (http-/ Determined request is valid, heading to Rich Customer Node
16:49:26,588 INFO  [stdout] (http-/ Entering Rich Customer Node
16:49:26,588 INFO  [stdout] (http-/ Detected and reporting valid request
16:49:26,588 INFO  [stdout] (http-/ Customer has amount: 5000 in the bank.
16:49:26,589 INFO  [stdout] (http-/ Leaving Rich Customer Node
16:49:26,589 INFO  [stdout] (http-/ Process ended in End Rich Customer Node.

You can examine the different ways you need to interact with the declarative model by examining the process in the web designer:

  • Initialize script task shows how to interact with process context variables and load our model with data.
  • Gateways can be viewed by examining the exit transitions, they show interaction with the model.
  • Adult Customer script task shows how facts are inserted into working memory using our declarative model.
I hope this demo helps in your understanding of the different ways our data model can be implemented in JBoss BRMS BPM projects.


Download Building Reactive Microservices in Java: Asynchronous and Event-Based Application Design. Brought to you in partnership with Red Hat


Published at DZone with permission of Eric D. Schabell, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}