2012 02-04 fosdem 2012 - guvnor and j bpm designer

Download 2012 02-04 fosdem 2012 - guvnor and j bpm designer

If you can't read please download the document

Upload: marcolof

Post on 16-Apr-2017

3.098 views

Category:

Technology


3 download

TRANSCRIPT

drools

Geoffrey De SmetMarco Rietveld

Managing workflows and business rules with
Guvnor and jBPM designer

Business Logic Integration

BusinessLogicIntegrationPlatform

Rule
engine

Workflow

Complex event
processing
(CEP)

Business Rule
Management System(BRMS)

Automated
planning

Geoffrey De Smet

Why would I need
Drools and Guvnor?

Use cases

I have hammer,
so every problem is a nail?

The myth

Drools is a rule engine

So becauseDrools can fulfil business rules

Drools is Turing complete

we should write the entire business layer in Drools?No!

Not imperativeNot like Java, Scala, Groovy, ...

DeclarativeLike RegEx, SQL, JPA-QL,

Easier to read, better at scaling

When to use Drools

Extract business decisions in Drools that either:Require schooled domain expertise

Change often/fast

Use cases

Financial decisionsMortgages acceptance and interest calculation

Insurances acceptance and fee calculation

Use cases

Financial decisionsMortgages acceptance and interest calculation

Insurances acceptance and fee calculation

Price calculationsPhone/Telecom bills

Use cases

Financial decisionsMortgages acceptance and interest calculation

Insurances acceptance and fee calculation

Price calculationsPhone/Telecom bills

DiagnosticsPossible diseases based on symptoms

Use cases

Financial decisionsMortgages acceptance and interest calculation

Insurances acceptance and fee calculation

Price calculationsPhone/Telecom bills

DiagnosticsPossible diseases based on symptoms

Complex validationCar parts selection

Use cases

Financial decisionsMortgages acceptance and interest calculation

Insurances acceptance and fee calculation

Price calculationsPhone/Telecom bills

DiagnosticsPossible diseases based on symptoms

Complex validationCar parts selection

Not a good use case: an XML parserUse Java code for that

Mortgages example

Developers don't like
data input from spreadsheets

Before App 1.0: Mortgages rules in a spreadsheetWhich version/copy of the spreadsheet file?

Which field has the result our application needs?

Version 1

Version 2

Mortgage experts like
the flexibility of spreadsheets

Since App 1.0: Mortgages rules in source codeChanging business rules not flexible enough

Business rules are hard coded in Java

Invalid: must be a number

Mortgage experts change their mind a lot

Flooded with new improvement requests:when income below 500

when income below 1000 and age above 50

when income below 1% of mortgage amount

Invalid: must be a number

Mortgage experts like the flexibility of Guvnor

App 2.0: Mortgage rules in Guvnor repositoryFlexible like spreadsheetBut backed by formal DRL and JavaBeans

No spreadsheet versions/copies

My business requires
domain expertise

Only mortgage managers
understand mortgage rules

Schooled domain expertise

Are we, the developers, domain experts?Yes, we've been working in this company for year(s).

Schooled domain expertise

Are we, the developers, domain experts?Yes, we've been working in this company for year(s).

Do we haveuniversity's degree in economics? No

participated in mortgages conferences/courses? No

years of mortgage customer experience? No

Schooled domain expertise

Are we, the developers, domain experts?Yes, we've been working in this company for year(s).

Do we haveuniversity's degree in economics? No

participated in mortgages conferences/courses? No

years of mortgage customer experience? No

Do we have a clue when the mortgage rules need to change? No

Schooled domain expertise

Are we, the developers, domain experts?Yes, we've been working in this company for year(s).

Do we haveuniversity's degree in economics? No

participated in mortgages conferences/courses? No

years of mortgage customer experience? No

Do we have a clue when the mortgage rules need to change? No

Are we, the developers, domain experts? NoMortgage manager is the domain expert

Domain experts can not read/write Java source code

Communication problemDomain expert can not read it:

for (Mortgage m : mortgages) { for (Applicant a : m.getApplicants()) { if (a.getAge() > 70) { boolean existsGuarantor = false; for (Guarantor g : m.getGuarantors() { if (g.getAge < 60) { existsGuarantor = true; } } // Will they spot the bug in this code? if (existsGuarantor) { m.setApproved(false); } } }}

Domain experts can read rules
in the Guided Rule Editor

Domain experts can write rules
in the Guided Rule Editor

Change

Translated to DRL
Executed on JavaBeans

Guided Rule Editor demo video

Demo video

Natural language (DSL)

DSL is even easier to read/write

Developers create the building blocks

Domain experts make the building

Source: wikipedia

My business rules
change often

This mortgage rule change must be
released by noon

Deliver changes fast

Deliver changes fast

Deliver changes fast

Business rule change

Not a data changeRequires test and release lifecycle

Logic changes

Not a software changeDelivered in hours, not days

Self-service by mortgage manager

Testing before releasing

Domain experts need to unit test tooExample: mortgage of Erik must be disapproved

Releasing

Release a snapshot of the rules package

Available at URL:http://127.0.0.1:8888/org.drools.guvnor.Guvnor/package/presentationmortgages/mortgagesDeployment

Deployment infrastructure

Auditable and reproducible

Why was that mortgage approved last year?

Auditing

View old revisions of rules

Summary

Summary

Use Drools and Guvnor

When your business decisions eitherRequire domain expertise

Change often/fast

Marco Rietveld

Whos heard of BPM? Whos actually written BPMN?

Whos heard of jBPM?

Whos worked with business analysts? Who has enjoyed working with business analysts? Whos sees themselves becoming a business analyst in the coming years? ... my apologies.

How do we keep business analysts from bothering us?

Wait, you want A to do D, but not B and C?!?

Please, if you become a business analyst, let the developers do their work.

Ive worked a few different places where the software requirements were filled with business terms that took a while to learn. Regardless of where you work, as a developer you have to learn the domain: bank accounts, freight logistics, insurance models, etc.

Part of the problem here is that not only do the business analysts have to create and write down the business process we then have to translate it into code.

Theres a duplication of effort in the sense that both analyst and developer sometimes have to understand the business process fully.

And of course, there are always gotchas -- my housemate was complaining the other day about how they wanted generic screens for processing orders (train-related company) except for that 1 (of 7) screen.

How do we let business analysts do their work?

This is a slightly more polite version of the last slide.

We want the business analysts to concentrate on the business process not the code.

(Anecdote: an ex-colleague analyst of mine was great but he was an old developer, and wanted us to code things certain way. I would say to him: The hell with that you do your work, Ill do mine!)

Make them active participants in the process.

BPM, BPMN 2.0 and jBPM

What does jBPM Designer do?

Demo

Summary

The agenda

This is what Im going to talk about:

- Business Analyst stuff and what we then use to implement it- What is this thing im talking about and.. what does it do? - Demo! (people who are taking naps, please wake up) - Summary, because youll have forgotten everything I said before the demo

Business Process Modelling

Visibility

Monitoring

High-level

Continuous improvement

Speed of development

Increased agility

A business process is a collection of steps that when executed, accomplish a specific goal.It can often be described using a flow chart.

Its why developers at companies who dont make software, get paid.

Not really its more than that: its whole interaction.

Visibility: Hey, I can understand whats happening!Monitoring: Wow, I can really see whats happening now!High-level: Huh, I understand whats going on here. Continuous: Modification of BPs without developer involvementSpeed: Which means work is done more quicklyAgility: Which means companies/development can respond more quickly

Flexible and Adaptive Processes

Traditional workflow systems have problems with change, complexity, flexibility, data-intensive applications...

BPM helps us with: Unstructured, non-linear or flexible processes

Adaptive Case ManagementData dependent/conditional processes

Event-driven BPM

Worked at a logistics company, and changing how incoming freight information was processed was a nightmare. - Change requests- New Projects- AHHH... Im having flashbacks.

Unstructured/Non-linear: maybe its not a A, B, C process:- for example: Monitoring, processing incoming streams of inputAdaptive Case Management- Basically, data-driven processes where the process is based on the data, not the other way aroundEvent-driven: - Multiple events processed in one process

BPMN 2.0

OMG specificationModel

Notation

Execution semantics

Understandable by all business users

Extensible

Model: graphicalNotation: xml-based syntaxExecution: how things should be done

Understandable -- see next slide, xml, not easily readable- collaboration between different parties- and were moving on, now..

BPMN 2.0 Example

System.out.println("Hello World");

...


Ehh.. no one wants to write bpmn 2.

Which is why we have the designer

So.. we have a way of looking at business processes and a way of specifying them..

Hey, were done with the Business Analyst stuff..

jBPM project

Open-source business process managementEmbeddable, lightweight Java process engine, supporting native BPMN 2.0 execution

Eclipse-based and web-based editor

Pluggable persistence and transactions (JPA / JTA)

Pluggable human task service based on WS-HumanTask

Management console (process instance management, task lists, task form management, and reporting)

History logging (querying / monitoring / analysis)

Etc..

JBPM is an open-source business process management project, for those of you who dont know how to read

jBPM application architecture

RulesCore
EngineGuvnorRepositoryEclipse EditorWeb-BasedDesignerHistoryLog

TaskServicejBPM Console

Core Services

BusinessAnalyst

End User

Developer

YourApplicationYourServices

Explain diagram

Point out integration with rules

BPM, BPMN 2.0 and jBPM

What does jBPM Designer do?

Demo

Summary

So, done with the background, and now were going to look at Designe

Lead on Designer in Tihomir Surdilovic, based on the Oryx project with lots of additionsr

jBPM 5 Designer

Integrated with GuvnorVersioning, storage and deployment

Embeddable (in your own application)includes a javascript interface

JSON used for communication

Targets business usersAllows users to focus on process creation

BPMN 2.0 web editorCreates fully executable BPMN

Supports the jBPM BPMN subset

So, we edit BPMN processes here.

The BPMN it creates conforms to the BPMN syntax (big surprise!) and it works with BPMN internally.

But it does more.. (and Ill get to that in a sec). Guvnor integration helps make guvnor the one-stop shop

Some people have built their own applications by embedding Designer and using the Guvnor rest api.

jBPM Designer Features

1. Shape repository panel

2. Canvas

3. Properties panel

4. Toolbar

5. Footer

6. Process information

This is just a brief overview so that you guys will know where to look when Im doing the demo.

Designer: Shape Menu

1. Connection section2. Morphing section

On the left is a set of images showing how the shape menu works.

Designer: Task Form Generation

Automatic generation of forms for human tasksUsing defined process variables, human task data I/O parameters and associations

(HTML/Javascript) Source immediately available

Generated forms are stored in Guvnor

All forms are fully usable inside jBPM console

Each form includes basic JavaScript form validation

Task form generation

Business analyst stuff

Obligatory introduction to project

Demo!

Summary (AKA The End)

The Slide
that you guys look at
while I switch to the demo!

Bonus: how many (full or partial) circles are on this slide?

Demo: Employee Evaluation

1. jbpm-installer + latest version of Designer

+ latest version of Guvnor

2. Start up installer(JBoss AS7 + Guvnor + Designer + Console)

3. Create process in Guvnor/DesignerImport real process...

4. Save process

5. Run process!

Summary

How do we keep them busy?

BPM & BPMN 2: Business Process ModellingGo work on the Business Process!

jBPM: how to implement an analysts workProcess engine that executes the BPMN

jBPM Designer: Look at what you can do!BPMN process creation and modification

Integration with Guvnor: Versioning, storage and deployment

Q&A

Drools/Guvnor homepagehttp://www.jboss.org/drools

jBPM homepagehttp://www.jboss.org/jbpm

Source code: http://www.github.com/droolsjbpm

Designer: http://www.github.com/tsurdilo/process-designer

Download this presentationhttp://www.jboss.org/drools/presentations

Twitter: @geoffreydesmet & @marcorietveld

Google+: Geoffrey De Smet & Marco Rietveld

IRC: #drools, #droolsdev and #jbpm on Codehaus

Image sources

http://images2.visual-paradigm.com/bpva/tutorials/businessprocessmodeling_screenshots/31_complete_bpd.png

http://mainthing.ru/wp-content/uploads/2010/12/battleship-en.png

http://www.slideshare.net/krisverlaenen/jbpm5-argentina-workshop

JBPM online documentation: http://docs.jboss.org/jbpm/v5.2/userguide/

This is the title
Second line of the title

Click to edit the outline text formatSecond Outline LevelThird Outline LevelFourth Outline LevelFifth Outline LevelSixth Outline LevelSeventh Outline LevelEighth Outline LevelNinth Outline Level

This is the chapter title

This is the subtitle