Pages

  • Home
  • Publications
  • Experience
  • Software
  • University Courses
  • Free Linux Courses
  • PFC Henry L. Hooper
  • Contact
spacer

Tuesday, March 19, 2013

Red Hat JBoss BRMS - adding a declarative data model to the Customer Evaluation demo

spacer
Customer Evaluation
with
declarative data model
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.

spacer
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:
  • clone the project from https://github.com/eschabell/brms-customer-evaluation-demo/tree/v1.4
  • add JBoss BRMS product, see installs/README
  • run init.sh to setup project
  • start JBoss BRMS server at with standalone.sh (in newly created target directory)
  • import support/repository_export_declarative_model.zip into BRM at localhost:8080/jboss-brms
  • build project and deploy
  • run process from Business Central at localhost:8080/business-central and see server log.
You server log should play out something a lot like this:

16:49:24,047 INFO  [stdout] (http-/127.0.0.1:8080-3) starting new transaction
16:49:26,555 INFO  [stdout] (http-/127.0.0.1:8080-3) Entering Initialize Node
16:49:26,556 INFO  [stdout] (http-/127.0.0.1:8080-3) There as no evaluation objects defined, adding default ones for demo purposes.
16:49:26,562 INFO  [stdout] (http-/127.0.0.1:8080-3) Leaving Initialize Node
16:49:26,565 INFO  [stdout] (http-/127.0.0.1:8080-3) Gateway: Qualify Age
16:49:26,565 INFO  [stdout] (http-/127.0.0.1:8080-3) Gateway: Qualify Age
16:49:26,567 INFO  [stdout] (http-/127.0.0.1:8080-3) Entering Adult Customer Node
16:49:26,568 INFO  [stdout] (http-/127.0.0.1:8080-3) Detected and reporting valid request
16:49:26,569 INFO  [stdout] (http-/127.0.0.1:8080-3) Set validRequest to: true
16:49:26,573 INFO  [stdout] (http-/127.0.0.1:8080-3) Leaving Adult Customer Node
16:49:26,573 INFO  [stdout] (http-/127.0.0.1:8080-3) Entering Finance Rules Node
16:49:26,585 INFO  [stdout] (http-/127.0.0.1:8080-3) Leaving Finance Rules Node.
16:49:26,585 INFO  [stdout] (http-/127.0.0.1:8080-3) Gateway: Decide Financial Status
16:49:26,585 INFO  [stdout] (http-/127.0.0.1:8080-3) Determined request is valid, heading to Rich Customer Node
16:49:26,588 INFO  [stdout] (http-/127.0.0.1:8080-3) Entering Rich Customer Node
16:49:26,588 INFO  [stdout] (http-/127.0.0.1:8080-3) Detected and reporting valid request
16:49:26,588 INFO  [stdout] (http-/127.0.0.1:8080-3) Customer has amount: 5000 in the bank.
16:49:26,589 INFO  [stdout] (http-/127.0.0.1:8080-3) Leaving Rich Customer Node
16:49:26,589 INFO  [stdout] (http-/127.0.0.1:8080-3) 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.

Monday, March 18, 2013

jBPM5 Developer Guide review

spacer
I had previously done a review on the first jBPM Developer Guide that Packt offered and was not very impressed. When approached this time I was hesitant to review when asked, but thought it deserved at least a look.

Below you will find my impressions and comments as I first give you an overview, then walk through each chapter.

General impressions

The previous review showed a lack of editing, but this time it is a professional manuscript. There could be a better use of references and the addition of a bibliography as many links are just included in-line which disturbs the flow of learning for a reader.

The authors state that they are targeting java developers and architects. I found that they dive fast and deep into topics like BPM, jBPM and Java technical concepts that you need to consider this book as targeting advanced or senior Java developers and technical architects. It is really meant for those implementing jBPM projects and less for those evaluating jBPM as a potential BPM solution.

The price online right now is just over 20 euros for the e-book and 38 euros for the printed version, contains 364 pages, it is good value for the money.  It reads easily and if you are familiar with the content you can easily jump to sections that interest you without worrying about missing material from earlier chapters.

Chapter 1 - Why do we need BPM

Authors start with a theoretical background of BPM as to why you would do this and attempts to position the 'business' aspect of BPM. It is then strange that the authors state, “If you hate the word 'business' as much as I do, please feel free to mentally skip it or replace it...” This warns us of the authors views being technical or developer centric in their focus.

The rest of the chapter is a light dusting of how to get to the point where the focus of this book lies, coding your BPM project. If you are interested in this facet of BPM within your organization then you would be well served to dig deeper elsewhere. Would have been nice if a few references were provided for readers looking for more.

Chapter 2 - BPM systems structure

he authors dive in head first, taking you into the BPM core engine and process concepts without being shy about putting code samples in front of you. It is exactly what a senior developer is looking for to get her head around jBPM for a project. You will need to pay close attention as concepts are dealt with that do not appear in jBPM5 as we know it (token based approach in designing a process engine) which might confuse readers. The internals are exposed to the reader on the hand of a basic process to try and keep the code snippets as small as possible.

As we continue the chapter we are taken through the HT, BAM, history, persistence, transactions, and data mining tools as related to BPM. This marches right into the Knowledge api's as jBPM5 is very closely tied into the Drools project; KnowledgeBuilder, KnowledgeBase, and KnowledgeSessions.

The authors then turn off the path a bit with a tour of SOA, BPEL, ESB, Rule engines, event driven architecture, and CEP. As you can see, this chapter is a whirlwind tour of placing BPM into the architectural complexities that you might be faced with in your organization. Again, you would be well served by references to these topics where the authors only lightly touch on them.

Chapter 3 - Using BPMN2 to model business scenarios

Designing your business processes with BPMN2 might not really be what you are interested in, but understanding some of the concepts within this standard can be helpful. This chapter walks through some of the basic elements, but for more complete coverage the authors should have pointed the readers to other content (such as Bruce Silver BPMN Method and Style).

We are then taken by the hand through a hospital emergency example scenario which is an excellent way to mentor the reader through a process project. The various decisions and concepts covered so far are explained and the reader is walked through the process, including details around what actual BPMN2 XML process definition code looks like.

Chapter 4 - Knowing your toolbox

In this chapter we are introduced to our BPM tooling, with something called a Business Logic integration Platform (BLiP). I have never heard of this term BLiP (again, no references are provided), so can only assume the authors are introducing the concept but fail to define it to my satisfaction.

The chapter gets you rolling by installing the jBPM5 Platform and summarizing the components; JBoss app server, Guvnor, process server, GWT console, web designer, and how to get started with the samples in an Eclipse IDE. You will have not only the platform up and running, but also your development environment configured with an example process that you will build and run in the jBPM GWT console.

Chapter 5 - The process designer

We tour the process designers available to us in this chapter; jBPM Eclipse plug-in designer, web process designer, and finally the Native Eclipse project called the BPMN2 Modeler (incorrectly referred to in this chapter as the Eclipse BPMN2 Plugin). Again a shame that the authors did no include references to the designer projects discussed.

The rest of the chapter takes up on a more detailed tour of the web process designer, arguably the best component in the jBPM5 project. This is done based on an example process for emergency hospital bed allocation, keeping in-line with the running hospital theme in the book. this is done in three iterations, an excellent example of real world refining of your process project as it evolves over time. You should be properly amazed by the end of this chapter and able to design your first process with relative ease.

Chapter 6 - Domain specific processes

Domain specific processes is covered in the detail that most will need to expand their processes with custom nodes. This is a very important topic and the authors cover the various nuances that will be very important to the readers and their process projects. Having used this feature several times, I can verify that I could have used this chapter. The example project used to highlight the various concepts is not for beginners, but if you got this far you have shown that you are a developer of some experience.

Chapter 7 - Human interactions

We dive into another very important topic, human interaction with your processes. Interaction with the HT service is explained with an example project and runs over into building your own UI to interact with your tasks.

It can argue that this is beyond the scope of the target subject of this book, but in this case reality is that organizations are building their own interfaces to have a consistent look and feel. The authors taking the time to elaborate on the functionality exposed to allow you to create your own task interfaces is extremely interesting.

Chapter 8 - Persistence and transactions

This chapter walks through the persistence and transaction functionality as it applies to jBPM 5. Not only do we find out how it works, but we are shown how to configure it to our needs.

Chapter 9 - Smart processes using rules

Here is where the authors add intelligence to our business processes by showing us how to integrate rules or decisions into our processes by leveraging the Drools Rule Engine.

I got excited when I first saw the section 'Multi-process instance evaluations' as I thought they would detail the issues with using a single StatefulKnowledgeSession. I was interested in how multiple instances can interfere with each others facts as inserted into working memory, where we then have one process instance farther along that requests a rule evaluation (fireAllRules) thereby removing all facts and/or modifying facts in working memory. This will effect the second instance that tries to request a rule evaluation only to find the fact as she inserted them have mysteriously vanished. The only real option is to manage process execution so that process instances have their own individual StatefulKnowledgeSession.

The authors side-step this here, but as we will find out later it is revisited in chapter 11.

Chapter 10 - Reactive processes using Drools Fusion

A chapter covering rules or decisions using a temporal element. Reasoning over time, or better known as Complex Event Processing (CEP). The authors also introduce Event Driven Architectures (EDA), but this is not woven into the rest of the chapter nor are there references made for further reader research.

The technology from within Drools Fusion project is covered in deep technical detail, giving you a strong basis should you wish to add these concepts to your processes.

Chapter 11 - Architectural and integration tips

This chapter covers designing your architecture based on how your process project requirements pan out. Here the authors state, "Most of the time, we don't exactly know what our applications will look like until we start coding and narrowing down its requirements..." This is a very ad-hoc developer oriented take on process projects that would never gain traction within enterprise process projects. I suggest we all try to take these comments that we encounter in this book with a grain of salt.

The authors spend considerable effort trying to convince the reader of the importance of where the KnowledgeSession needs to reside in your architecture. I think the real value in this chapter starts at the section “One session per process instance”, s
gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.