Example of DMN (Decision Model & Notation) execution in jBPM 7

jBPM 7 has support for OMG's DMN specification 1.1 (http://www.omg.org/spec/DMN/1.1/) conformance level 3.  What this means is jBPM 7 not only supports decision requirements, decision logic, and decision tables (conformance level 1) but also supports the full FEEL (Friendly Enough Expression Language) specification.  Unfortunately jBPM 7 currently doesn't include an authoring tool to create DRDs (Decision Requirements Diagram).  For this I am using Trisotech's DMN authoring tool (http://www.trisotech.com/dmnquickstart).

I'm using a simple car insurance quote problem to demonstrate the capabilities of DMN.  I'm also integrating DMN to BPMN using jBPM 7.5 running on Wildfly 10.1.

Decision Requirements Diagram

To keep the example simple I'm using three inputs into the decision making process.  A Car that has attributes type, age, and price.  A Driver that has age, number of tickets, and number of accidents.  And a base quote amount.




The above image shows the decision diagram.  I use the Car and Driver's attributes to decide on a multiplier for the base quote to produce a end quote.  Instead of using a business knowledge node I'm encoding the decision logic directly in the decision node.  Each of the decision nodes is supported by a decision table.



The decisions are chained together to produce the final quote.  



Business Process (BPMN)

Using the jBPM workbench, I created a BPMN diagram to capture the inputs, get the quote from the DMN decision node, and display the final quote to the command line.


Integrate the DRD

In order for the business process to execute a DRD, I did the following.
  • Export the DRD in Trisotech's authoring tool as a .dmn file.
  • Open the file and note the following items from the XML:
    • Namespace - namespace="http://www.trisotech.com/definitions/_34ef0eb5-6e39-4c82-a763-fcdb27965cab"
    • Model name - name="car_insurance_quote"
  • Upload the .dmn file into the jBPM project - "Create New Asset" -> "Uploaded file".
  • In the business process, create a business rule task and change the "Rule Language" to DMN.


  • In the same business rule task, add the following input and output mappings.


  • Note the first two entries are the namespace and model we captured earlier.  The third entry is optional and indicates which decision we want the output from.  The rest of entries are the inputs to decision process.  The only output entry maps the output of the Quote decision node to the quote variable.

Running the example

After the business process is finished.  I created some forms to capture the input data.  Before executing the process, I built and deployed it to the local execution server.  Then I use the workbench to run the example.



After submitting the inputs, you should see the following in the logs.




Get the code!

If you want to play around with the project I created you can import it into jBPM 7.5 using the workbench.


  • First in the workbench click Design.




  • Go to the base Space page and create a new space called "com.redhat.demo.dmn".
  • Go into that Space and click the "Import Project" button.


  • Finally enter the following url - https://github.com/mrhaowu/car_insurance_quote.git






References





Comments

  1. Very informative and impressive post you have written, this is quite interesting and i have went through it completely, an upgraded information is shared, keep sharing such valuable information. Cloud Workflow

    ReplyDelete

Post a Comment

Popular posts from this blog

Decision Driven Business Processes Using Red Hat BPM Suite 6.4