You are using DMN to model and execute your business rules? You were happy and pleased at the beginning, but as the project and the rule sets grow, you want to reuse decision tables and orchestrate more complex decision graphs? We look at issues you might encounter running large scaled enterprise applications and how they can be solved.
3. Holisticon AG is a Management and IT
consulting company based in Hamburg,
Germany.
■ Founded 2007 // 13+ years
■ Offices in Hamburg, Hannover, Kiel
■ About 70+ handpicked consultants
■ Camunda Advanced Partner
Jan Galinski
■ ~ 15 years Workflow Management
■ ~ 8 years with Camunda
■ Contributor and (Co-)Author of
spring-boot-starters, mockito extension,
reactor extension, …
■ Camunda User Group Hamburg
■ BPM Craftsman, Consultant, Developer
https://about.me/jangalinski
5. DMN on Steroids 2.0 | jan.galinski@holisticon.de | 5
What is DMN?1 – Decision Table
https://camunda.com/dmn/simulator/
AND
OR
FEEL
6. DMN on Steroids 2.0 | jan.galinski@holisticon.de | 6
What is DMN?2 - DRG
https://camunda.com/dmn/simulator/
7. DMN on Steroids 2.0 | jan.galinski@holisticon.de | 7
Benefits of DMN
OMG Standard No vendor lock-in
Business IT Alignment Business can read and write decisions
Executable No separation of build and runtime model
Transparency What decision was made based on which input and when?
Flexibility Change how your decisions are made, without downtime
!
13. DMN on Steroids 2.0 | jan.galinski@holisticon.de | 13
Make your rules explicit1
■ Requirement Engineering
„We must only execute this action, if the customer is an adult!“
„What does that mean?“
„Well, in Germany, this means, the person has to be at least 18 years old!“
„I thought 21?“
„No, they changed that 50 years ago.“
„OK, will do!“
1
14. DMN on Steroids 2.0 | jan.galinski@holisticon.de | 14
Make your rules explicit2
■ Input: interpreted value
■ Business relevant comparison done by some service
■ Runtime: „Hey Jan, why was this action not allowed?“ –
„I will have to check with Simon, he wrote the isAdultSubComponent!“ –
„Stay until this is solved!“
1
15. DMN on Steroids 2.0 | jan.galinski@holisticon.de | 15
Make your rules explicit3
■ Input: age of customer
■ Comparison done by decision table
■ Runtime: „Hey Jan, why was this action not allowed?“ –
„Well the rule said, he had to be 18, but he was only 17!“ –
„Thanks, Jan! Have a nice weekend!“
1
17. DMN on Steroids 2.0 | jan.galinski@holisticon.de | 17
Use FEEL1
■ Requirement Engineering
„We must only execute this action, if the customer is an adult!“
„I have an idea! Camunda supports
multiple expression languages in decision tables!“
„I trust your judgement“
2
18. DMN on Steroids 2.0 | jan.galinski@holisticon.de | 18
Use FEEL2
■ Input: customerId, no need for additional services
■ Business relevant comparison done by groovy code in decision table
■ Runtime: „Hey Jan, why was this action not allowed? It clearly says: 18“ –
„Hm. Some Bug with our DateUtils? The customers birthday is ok! “ –
„Stay until this is solved!“
Using GROOVY*
2
19. DMN on Steroids 2.0 | jan.galinski@holisticon.de | 19
Use FEEL3 - Benefits
Simple
No complex calculations,
only comparison
Business IT
alignment
Business can read* and write* decisions
Execution Pure functions – DMN as „black box“
2
21. DMN on Steroids 2.0 | jan.galinski@holisticon.de | 21
DMN != <code>1
■ Requirement Engineering
„We have a new government. Adulthood now starts at age 16! What do we do“
„ Too bad. We have our DMN files in src/main/recources, like our BPMN files.
We will have to alter them and do a deployment.“
„Can you do it, please?“
„Of course! File a jira issue, we have a deployment scheduled for next Thursday
anyway!“
„I need it now!“
„Wait a minute … we got an enterprise license, right?“
3
23. DMN on Steroids 2.0 | jan.galinski@holisticon.de | 23
DMN != <code>3
■ Next Thursday
„Major incident! You have to be 18 again to be an adult! What happened!“
„We did the scheduled deployment this morning.
And as I said: the DMN files are part of our code base, so we deployed them over your
hot fixes!“
„That‘s going to be long day, my friend!“
3
24. DMN on Steroids 2.0 | jan.galinski@holisticon.de | 24
DMN != <code>4
„Well, good news, then: We can change
and deploy our rules as part of the
configuration, without modifying the
core app.“
„Will that require a downtime? Should I
inform operations?“
„ No need to, just give me a second ….“
„Well done, Jan!“
3
Process
Application
(DMN) Config
Repository
Camunda DB
■ Requirement Engineering
„We have a new goverment. Adulthood now starts at age 16! What do we do“
„Did the required inputs change?“
„No!“
26. DMN on Steroids 2.0 | jan.galinski@holisticon.de | 26
Generate DMN1
■ Requirement Engineering
„Remember that little DMN project we set up last year?“
„Of course! Great success, right? “
„Well, kind of … we expanded our business, now look at this …“
4
27. DMN on Steroids 2.0 | jan.galinski@holisticon.de | 27
4Generate DMN2
https://en.wikipedia.org/wiki/Age_of_majority
(„Saudi Arabia“ AND (age>=15 OR puberty==true)
Order of rules
All other states
Default rule
28. DMN on Steroids 2.0 | jan.galinski@holisticon.de | 28
Generate DMN3
■ Complex tables?
■ Large tables?
■ Complex boolean logic?
■ Hit Policies?
■ Rule ordering?
4
?trivial
I can!
29. DMN on Steroids 2.0 | jan.galinski@holisticon.de | 29
Generate DMN4
4
■ Camunda can generate decision tables
But not decision graphs
■ Unintuitive direct XML API
31. DMN on Steroids 2.0 | jan.galinski@holisticon.de | 31
Divide and conquer1
■ Requirement Engineering
„OK, we got generators in place, but it‘s still hard to manage the DMN tables!“
„Why so?“
„Well, turned out is customer adult was not our only concern …“
5
32. DMN on Steroids 2.0 | jan.galinski@holisticon.de | 32
Divide and conquer2
5Legal aspects Product aspects
33. DMN on Steroids 2.0 | jan.galinski@holisticon.de | 33
Divide and conquer3
■ Options to split large tables into smaller ones
One table per region (sellproduct_germany.dmn, sellproduct_korea.dmn)
Chained execution of multiple tables: first legal aspects, then product aspects
Combined approach
■ Options to execute chained tables
Create a custom BPMN evaluation process
Use DMN Decision Requirement Graphs (DRG)
5
34. DMN on Steroids 2.0 | jan.galinski@holisticon.de | 34
Divide and conquer4 - DRG
■ OK, but …
50 Products= 50 Decison Graphs
Camunda does not support table references = 50 copies of the legal aspects table
When legal aspects change, you have to edit 50 tables
5
36. ■ Make your rules explicit
Context just delivers data
DMN does the comparison
■ Use Feel
Keep it simple
■ DMN != <code>
Do not put *.dmn files in src/main/resources
■ Generate DMN
Computers are better at modifying large tables
■ Divide and Conquer
Multiple small tables are easier to handle
than one large table
Use separate files for separate concerns
Generate DRGs
Ramp up
■ Bonus
Decision History grows fast. Use TTL, think
about clean up strategies
Consider how you want to test your DMNs …
41. . . .. . .
■ Property based testing
ensure the rules are correct for all possible inputs
■ Validation
using dmnCheck
■ Schema based Query/Result Objects
Becoming full type safe, generate code
■ Support complex input objects
currently limited to primitives
■ Caching
do not recalculate when nothing changed
■ Distributed Systems
event driven architecture/axon
■ Simulation
How would the system behavior change?
■ Auditing/Cockpit
better tracing/tracking of decision evaluations
Roadmap
Documentation, Documentation, Documentation
Buildtime Runtime
42. https://github.com/davidibl/dmnmgr-server
Have a look at …
dmn-check
■ DMN File validation
Duplicate rules
Conflicting rules
Shadowed rules
Types of the expressions
Correct use of enumerations
Correctly connected requirement graphs
https://github.com/red6/dmn-check
■ Camunda Modeler Extension
Define input/output via OpenAPI
Git repo as DMN store
Validation (using dmn-check)
Simulation
Client/Server architecture
dmnmgr
Disclaymer, no actual steroids used in this talk, but a lot of coffee
3 big questions: Who is speaking, What is DMN and what is this all about?
probably seen me here before, hattrick 3 strikes in a row, did some things in the past, worked on some extensions yopu might know
fanboy since fox/6.4
did some stuff ...
Wonderful company, 80/20, Hackday every week
I have 100 ideas per day, 99 are crap, 1 sticks, so I play around and if I think: This could actually work! I answer the call for paper … and here I am. This year it was tough
Practinioner, I need a running example, so there will be code
Normally now I would ask who of you is using DMN to pretend I can shift the weights in my presentation to adopt the background you have
Today I can not see you … so I assume that if you are watching a talk „DMN on Steroids 2.0, to decision tables and beyond“ you are familiar with the basics.
I will just cover the relevant parts for what we will discuss later.
Standard
DMN is not owned by a certain enterprise but by an institution (OMG), which is already established through other world-wide standards, e.g., BPMN and UML. The DMN standard is supported by several software products; you are less dependent on any particular vendor’s products.
Direct Execution
In DMN, decisions can be modeled and executed using the same language. Business analysts can model the rules that lead to a decision in easy to read tables, and those tables can be executed directly by a decision engine (like Camunda). This minimizes the risk of misunderstandings between business analysts and developers, and it even allows rapid changes in production.
Experience
DMN as a standard is young, but it was developed by people having decades of experience with business rule management. Even though, the standard does not dictate any special implementation patterns, allowing for more modern and lightweight implementations than traditional business rule engines.
Evaluation: Backend Service provides values for all input columns,
result contains all output columns
Result Structure depends on Hitpolicy
FEEL: friendly enough expression language
This is a decision graph
Good news: we dont need those ... and you already now this
Evaluation:Backend Service must provide data for all required inputs of all tables, except those where output->input are linked
Result is the result of the effective result table (last in line)
The round-cornered boxes are „input data“ … they are like the datasources in BPMN: use them if they make you feel better …the sharp edge cornered box is a „knowledge source“
Flexibility: DMN is to BPMN what BPMN is to code: you want faster changes, interact with running system.
So „someone“ is changing the behavior of your system, and especially in a dev ops world, for me as a developer that means: Find someone to blame!
“decisions“ was chosen because it sounds more positive than „rules“ … to me that is like speaking about „challenges“ instead of „problems“
So this might have been the last slide where I really concentrate on not saying „rules“ … from now on „rules“ refers to decisions …
There are so many talks out there already ... why this one.
I have, as you will see, a long history with DMN. I am using it for 5 years now and am a big fan.
BUT. Better is natural enemy of good … just to be fair: camunda did a great job, I love what we can do, and if camunda devs are watching: let‘s discuss this afterwards
Talk „DMN on steroids“, 2017 Torben Rasche, Stefan Becke
Skill based routing, Workforce Management
Numbers are guesses based on fading memories, probably more today (2 million calls per day)
Talk „Mastering debt recovery processes“ CamundaCon 2018 Karsten Lehmann
Case activities are „possible“ (enabled) if conditions are met, these are evaluated by DMN
And this is how I came up with …
No special order … and some are quite obvious
There are probably more than 5, but 3,5 7 always sounds good in an talk
1st rule: do not talk about ee-dmn
Enterprise DMN: non trivial, high dynamic, many executions
Hypothesis (to hard to pronounce): we might argue about them, my personal view … and not all of them are used in my project right now … but most of the time I wish they were
Beautiful: We can discuss how rules work
The example is simple and easy to understand
But still: way more than „hello world“
As mentioned before: a backend service collects the values for all input data.
If the service already resolves the rule,
there is nothing left for the decision table to do.
Dont hide rules! -> by applying recusrsion, every dmn could be condensed to one cell …
Better: just provide the raw data, let the dmn engine decide
Friendly Enough Expression Language
GROOVY*: This is NOT groovy … thats just some code I made up that should be as ugly as possible!
Asterisk: we come to that later
This might suprise you, because we say the complete oposite when it comes to BPMN
Part of the codebase:
I (the developer) own it,
I will not release it, until my other tasks are finished and the pipeline is green
This was discussed in the unconference slot on Wednesday a lot
enter cockpit - or use modelerchange datadeploy
play with fire: campfire, cozy, stories, Bob Dylan songs, so why bother
The order is important (HitPolicy First)
„or“ in Saudia Arabia
For USA, the state is relevant
And this is a really small example. And only for age of maturity, not even „can vote“, „can buy alcohol“, „can drive motorcycles“ …
And it is wrong … If you are from Indonesia, and below
we started of with one key benefit: read/write/business/it alignment
non-trivial: does not fit on one screen
in this case: write code that parses wikipedia and creates a table
copied from camunda offical docs ... don't like
Another way to maka non-trivial dmn trivial
Aka Separate concerns
something that we developers should be used to.
question is sell product
two aspects
split tables
execute as one rule
process: instead of 1 DMN, you get 3 files: 2 DMNs and ond BPMN
Is there copy&paste in the DMN modeler?
Machines can
bonus: time to live, delete from history
testing ... well , do not get me started
Enough chit chat
Show me the code!
Enough chit chat
Show me the code!
caching: pure functions (some limitations: time based and history)
This was it, before we go, if you are interested in these topics, make sure to check out
Today:
Dmnmgr: Davids talk Business Rules at a Glance
Business Architecture Track, 16:30 (half past 4)