44
jBPM 4 in Action jBPM 4 in Action by by Tom Baeyens & Joram Barrez Tom Baeyens & Joram Barrez

Devoxx 2009 Conference session Jbpm4 In Action

Embed Size (px)

Citation preview

Page 1: Devoxx 2009 Conference session Jbpm4 In Action

jBPM 4 in ActionjBPM 4 in Actionby by

Tom Baeyens & Joram BarrezTom Baeyens & Joram Barrez

Page 2: Devoxx 2009 Conference session Jbpm4 In Action

2

Speaker’s qualificationsFounded jBPM in 2003Project Lead of jBPMPassionate about BPM and JavaArticles/international conferences

JBoss jBPM core developer (06/09)Before: jBPM/BPM consultant

Page 3: Devoxx 2009 Conference session Jbpm4 In Action

3

jBPM is great for BPM*and*

for developers

Page 4: Devoxx 2009 Conference session Jbpm4 In Action
Page 5: Devoxx 2009 Conference session Jbpm4 In Action
Page 6: Devoxx 2009 Conference session Jbpm4 In Action

6

Business process

An (organized) way of 'doing things'... with a certain goal

Page 7: Devoxx 2009 Conference session Jbpm4 In Action

7

Processes are everywhere

Page 8: Devoxx 2009 Conference session Jbpm4 In Action

Processes are everywhere

Page 9: Devoxx 2009 Conference session Jbpm4 In Action

Processes are everywhere

Page 10: Devoxx 2009 Conference session Jbpm4 In Action

10

Conclusion

Any company Any productAny service

They all have business processes

Page 11: Devoxx 2009 Conference session Jbpm4 In Action

11

Conclusion

Any company Any productAny service

Which means– 'Doing business'

== executing some business process

They all have business processes

Page 12: Devoxx 2009 Conference session Jbpm4 In Action

12

Newsflash

Every app you write– Is (part of) a business process

So your job ...– implementing business processes!

Wouldn't you rather have a powerful, flexible framework where you can apply all your Java-powers?

Page 13: Devoxx 2009 Conference session Jbpm4 In Action

13

Introducing jBPM

Transactional state-machineGeneric graph execution engineBut most of all...

– A kick-ass JAVA BPM engine

Page 14: Devoxx 2009 Conference session Jbpm4 In Action

jBPM Evolution

jBPM 1• EJB state machine

jBPM 2• Std Java Embeddable

• Hibernate state machine

jBPM 3• First Activity Pluggability• First Multiple Languages

• First Enterprise Embeddability

jBPM 4• Activity Pluggability API

• Command Based Services •Multiple Languages

• Many Execution modes• DB Partitioning• DB Evolution

• Full Embeddability

Product

Project

Page 15: Devoxx 2009 Conference session Jbpm4 In Action

jBPM today

Page 16: Devoxx 2009 Conference session Jbpm4 In Action

jBPM today

Page 17: Devoxx 2009 Conference session Jbpm4 In Action

17

JBPM v4: what's new?Clean & simplified

– Based on 2nd generation PVM– New API (incl. cool query mechanism)– Compact db schema– Native Spring integration

Improved tooling– Sexy GWT console – Signavio web modeling

QA lab

Page 18: Devoxx 2009 Conference session Jbpm4 In Action

jBPM3 jBPM4

Page 19: Devoxx 2009 Conference session Jbpm4 In Action

Software Project

Executable Process

Processes As Part Of Software Development

Non-techBusiness Analyst Developer<details />

Java, XML, Buildscripts,Tests, …

EAPSOA-PJBossTomcatJDK 5

Oracle, MySQL, PostgreSQL

jBPM YourApp

Analyst

Developer

Abstract Process

Page 20: Devoxx 2009 Conference session Jbpm4 In Action

jBPM APIConfiguration cfg = new Configuration();

ProcessEngine processEngine = cfg.buildProcessEngine();

processEngine.getRepositoryService();processEngine.getExecutionService();processEngine.getHistoryService();processEngine.getTaskService();processEngine.getIdentityService();

jbpm.cfg.xml

Page 21: Devoxx 2009 Conference session Jbpm4 In Action

Print Dots

• Automatic activity• Print dots on the console

Page 22: Devoxx 2009 Conference session Jbpm4 In Action

Starting ProcessInstance

public void userClickedButton() { ... executionService .startProcessInstanceByKey("PrintDots"); ...}

SomeWeb

Framework

Page 23: Devoxx 2009 Conference session Jbpm4 In Action

<process name=“PrintDots">

<start> <transition to="print dots" /> </start>

<custom name="print dots" class="com.devoxx.jbpm.printdots.PrintDots"> <transition to="end" /> </custom> <end name="end"/>

</process>

Page 24: Devoxx 2009 Conference session Jbpm4 In Action

Bananas

• Get a quote for bananas• Asynchronously

FruitStore

executionService .signalExecutionById

MDB

Page 25: Devoxx 2009 Conference session Jbpm4 In Action

<process name="Bananas"> <start> <transition to="get price for bananas"/> </start>

<state name="get price for bananas"> <on event="start"> <event-listener

class="com.devoxx.jbpm.bananas.GetPriceForBananas"/> </on> <transition to="print price of bananas"/> </state>

<custom name="print price of bananas“ class="com.devoxx.jbpm.bananas.PrintPrice"> <transition to="end"/> </custom>

<end name="end"/></process>

Page 26: Devoxx 2009 Conference session Jbpm4 In Action

Yummie

• Choose 1 outgoing transition• Based on the price of bananas

Page 27: Devoxx 2009 Conference session Jbpm4 In Action

<process name="Yummie"> <start> <transition to="checkPrice"/> </start>

<decision name="checkPrice"> <transition to="yummie"> <condition expr="#{priceForBananas &lt; 10}" /> </transition> <transition to="hungry" /> </decision>

<custom name="yummie" class="com.devoxx.jbpm.yummie.PrintMsg"> <field name="msg"> <string value="Yummie!" /> </field>

</custom>

Page 28: Devoxx 2009 Conference session Jbpm4 In Action

... <custom name="hungry" class="com.devoxx.jbpm.yummie.PrintMsg"> <field name="msg"> <string value="I'm hungry :-(" /> </field> </custom>

</process>

Page 29: Devoxx 2009 Conference session Jbpm4 In Action

GetCoffee

• User task

addtask

Tasklist completetask

Page 30: Devoxx 2009 Conference session Jbpm4 In Action

<process name="GetCoffee">

<start> <transition to="get coffee"/> </start>

<task name="get coffee" assignee="johndoe"> <notification/> <transition to="print coffee"/> </task>

<custom name="print coffee" class="com.devoxx.jbpm.coffee.PrintCoffee"/>

</process>

Page 31: Devoxx 2009 Conference session Jbpm4 In Action

Other Features

• jPDL– Concurrency– Asynchronous continuations

• Task forms– Rapid prototyping

Page 32: Devoxx 2009 Conference session Jbpm4 In Action

Other Features

• Production usage– Installer– Upgrade– Process versioning & migration– Clusterable

Page 33: Devoxx 2009 Conference session Jbpm4 In Action

Other Features

• Tools– Eclipse process designer– Web based modeller (Signavio)– Web console

• Superfast

Page 34: Devoxx 2009 Conference session Jbpm4 In Action

Other Features

• Multiple process languages– jPDL– BPMN 2 !

Page 35: Devoxx 2009 Conference session Jbpm4 In Action

35

DEMODEMO•The train ticket demoThe train ticket demo

•INTROINTRO

Page 36: Devoxx 2009 Conference session Jbpm4 In Action

36

Taking the train 2.0 • The Problem

– Using coins, ticket machines, conductors, ... sooooo 2008

• The solution

JBPM on Rails

Page 37: Devoxx 2009 Conference session Jbpm4 In Action

37

Use case 1. Ticket request

Other Train System (EJB)

2.Price quote

3.Accept

Page 38: Devoxx 2009 Conference session Jbpm4 In Action

38

Architecture SMS Gateway

HTTP Interface (Servlet)

jBPM on RailsExt. Sys.

(EJB3)

User Registration

Page 39: Devoxx 2009 Conference session Jbpm4 In Action

39

Where can I find it?

Blog http://www.jorambarrez.be/blog/2009/09/18/train-ticket-demo-overview-final-part-getting-started-with-jbpm-in-less-than-a-minute/

Page 40: Devoxx 2009 Conference session Jbpm4 In Action

40

DEMODEMO•The train ticket demoThe train ticket demo

Page 41: Devoxx 2009 Conference session Jbpm4 In Action

41

JBPM v4: performance

process01 process02 process03 process04 process05 random0

2

4

6

8

10

12

jBPM 4.2 basic benchmark - Postgresql 8.3(10 000 executions)

Seq. exec.2 fixedTP3 fixedTP4 fixedTP5 fixedTP6 fixedTP7 fixedTP8 fixedTP9 fixedTP10 fixedTPav

g du

ratio

n (m

s)

Config: Ubuntu 9.04, AMD Phenom II X4 3.0Ghz, 8Gb Ram, 7200rpm HDDB and benchmark on same machine

Page 42: Devoxx 2009 Conference session Jbpm4 In Action

42

JBPM v4: performance

Avg process exec. time– 0.75ms – 2ms– 1.8 mil./hour– Yeah, that's fast

jBPM overhead == (extremely) minimal– So what are you waiting for?

Page 43: Devoxx 2009 Conference session Jbpm4 In Action

I just know you're excited to give it a try

You can do it tonight Just before you go to sleep Or even in your bed

Last demo movie

Getting started