Packt Pub.j BPM.Developer.Guide.Dec.2009
User Manual: Pdf
Open the PDF directly: View PDF .
Page Count: 371
jBPM Developer Guide
A Java developer's guide to the JBoss Business
Process Management framework
Mauricio "Salaboy" Salatino
BIRMINGHAM - MUMBAI
This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009
6393 south jamaica court, , englewood, , 80111
jBPM Developer Guide
Copyright © 2009 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy
of the information presented. However, the information contained in this book is
sold without warranty, either express or implied. Neither the author, nor Packt
Publishing, and its dealers and distributors will be held liable for any damages
caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.
First published: December 2009
Production Reference: 1101209
Published by Packt Publishing Ltd.
32 Lincoln Road
Olton
Birmingham, B27 6PA, UK.
ISBN 978-1-847195-68-5
www.packtpub.com
Cover Image by Filippo Sarti (filosarti@tiscali.it)
This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009
6393 south jamaica court, , englewood, , 80111
Credits
Author
Mauricio "Salaboy" Salatino
Reviewers
Jeronimo Ginzburg
Editorial Team Leader
Gagandeep Singh
Project Team Leader
Priya Mukherji
Federico Weisse
Acquisition Editor
David Barnes
Development Editor
Darshana S. Shinde
Technical Editors
Ishita Dhabalia
Charumathi Sankaran
Project Coordinator
Leena Purkait
Proofreader
Andie Scothern
Graphics
Nilesh R. Mohite
Production Coordinator
Shantanu Zagade
Copy Editor
Sanchari Mukherjee
Cover Work
Shantanu Zagade
Indexer
Rekha Nair
This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009
6393 south jamaica court, , englewood, , 80111
About the Author
Mauricio Salatino (a.k.a. Salaboy) has been a part of the Java and open source
software world for more than six years now. He's worked with several technologies
(such as PHP, JSP, Java SE, Java ME, and Java EE) during these years and is now
focused on JBoss frameworks. He got involved with the JBoss Drools project about
a year and a half ago as a contributor, gaining a lot of experience with the open
source community and with multiple technologies such as JBoss jBPM, JBoss
Drools, Apache RIO, Apache Mina, and JBoss Application Server.
During 2008 he dictated the official jBPM courses for Red Hat Argentina several
times, and he was involved in several JBoss jBPM and JBoss Drools implementations
in Argentina. He was also part of the Research and Development team of one of the
biggest healthcare providers in Argentina, where he trained people in the BPM and
Business Rules field.
Mauricio is currently involved in different open source projects that are being
created by the company he co-founded, called Plug Tree (www.plugtree.com),
which will be released in 2010. Plug Tree is an open source based company that
creates open source projects and provides consultancy, training, and support on
different open source projects.
Mauricio is an Argentinian/Italian citizen based in Argentina. In his free time
he gives talks for the JBoss User Group Argentina (www.jbug.com.ar), that he
co-founded with a group of local friends. He also runs his personal blog about
JBoss, jBPM, and JBoss Drools, that was originally targeted to Hispanic audiences
but is now aimed at an international audience and receives more than five hundred
questions per year.
I would like to thank my family for always being there to support
my decisions and adventures, my new and old friends who have
helped me during this process, all the Packt Publishing staff who
have guided me during these months of hard work; and last but
not least, the open source community guys who are always
creating new, interesting, and exciting projects.
This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009
6393 south jamaica court, , englewood, , 80111
About the Reviewers
Jeronimo Ginzburg has a degree in Computer Science from Universidad de
Buenos Aires, Argentina. He has more than 10 years of experience in designing
and implementing Java Enterprise applications. He currently works at Red Hat as
a Middleware Consultant, specialized in JBoss SOA-P (jBPM, Rules, ESB, and JBoss
AS). During the last four years, Jeronimo has been researching Web Engineering and
he has co-written articles published on journals, proceedings, and as a book chapter.
Federico Weisse was born in Buenos Aires, Argentina. He has over 10 years
of expertise in the IT industry. During his career he has worked with several
technologies and programming languages such as C, C++, ASP, PHP; different
relational databases (Oracle, SQLServer, DB2, PostgreSQL), platforms (AS400, Unix,
Linux) and mainframe technologies.
In 2002, he adopted Java as his main technology. He has been working with it since
then, becoming a specialist in this field. A couple of years later, he got involved with
BPM systems.
Nowadays, he is a J2EE architect of a BPM system based on OSWorkflow in one of
the most important healthcare providers of Argentina.
I want to thank Mauricio for choosing me to review his book, which
I think has great value for the developers who want to get to know
BPM theory and jBPM technology.
I also want to mention the effort and dedication of all the developers
around the world who provide open source software of excellent
quality, making it accessible for anyone eager to get new IT
knowledge.
This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009
6393 south jamaica court, , englewood, , 80111
This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009
6393 south jamaica court, , englewood, , 80111
Dedicated to my loving future wife Mariela, and especially to my mother
who helps me with the language impedance.
This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009
6393 south jamaica court, , englewood, , 80111
This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009
6393 south jamaica court, , englewood, , 80111
Table of Contents
Preface
Chapter 1: Why Developers Need BPM?
1
7
Business Process, why should I know about that?
"A sequence of tasks that happen in a repeatable order"
"executed by humans and/or systems"
"to achieve a business goal"
I know what BPs are, but what about the final "M" in BPM?
BPM stages
BPM stages in a real-life scenario
BPM improvements
8
8
9
12
12
13
15
16
BPM and system integration "history"
Some buzzwords that we are going to hear when people talk
about BPM
Theoretical definitions
18
Global understanding of our processes
Agile interaction between systems, people, and teams
Reduce paperwork
Real time process information
Process information analysis
Statistics and measures about each execution
Integration (system integration)
Workflow
Service Oriented Architecture (SOA)
Orchestration
Technological terms
Workflow
Enterprise Service Bus (ESB)
BPEL (WS-BPEL)
16
16
17
17
18
18
19
19
20
20
21
21
21
21
21
22
This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009
6393 south jamaica court, , englewood, , 80111
Table of Contents
Business Process Management Systems (BPMS), my tool
and your tool from now on
BPM systems versus BPM suites
Why we really need to know BPM and BPMS, and how do they
change/impact on our daily life
New approach
Homework
Summary
Chapter 2: jBPM for Developers
Graph Oriented Programming
Common development process
Database model
Business logic
User interfaces
Decoupling processes from our applications
Graph Oriented Programming on top of OOP
Implementing Graph Oriented Programming on top of the
Java language (finally Java code!)
Modeling nodes in the object-oriented world
Modeling a transition in the object-oriented world
Expanding our language
Process Definition: a node container
Implementing our process definition
The Node concept in Java
The Transition concept in Java
The Definition concept in Java
Testing our brand new classes
Process execution
Wait states versus automatic nodes
Asynchronous System Interactions
Human tasks
Creating the execution concept in Java
Homework
Creating a simple language
Nodes description
Stage one
Stage two
Stage three
Homework solution
22
22
23
23
25
27
29
30
30
32
32
32
33
34
35
37
37
38
39
40
40
41
42
43
44
45
46
47
48
52
53
54
55
56
57
59
[ ii ]
This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009
6393 south jamaica court, , englewood, , 80111
Table of Contents
Quick start guide to building Maven projects
Summary
Chapter 3: Setting Up Our Tools
Background about the jBPM project
JBoss Drools
JBoss ESB
JBoss jBPM
Supported languages
Other modules
Tools and software
Maven—why do I need it?
Standard structure for all your projects
Centralized project and dependencies description
Maven installation
59
59
61
62
64
64
64
65
66
68
69
70
70
71
Installing MySQL
72
Eclipse IDE
73
Downloading MySQL JConnector
73
Install Maven support for Eclipse
74
SVN client
Starting with jBPM
Getting jBPM
74
75
75
jBPM structure
Core module
DB module
Distribution module
Enterprise module
Example module
Identity module
Simulation module
User Guide module
Building real world applications
Eclipse Plugin Project/GPD Introduction
82
83
84
84
84
85
85
86
86
86
86
From binary
From source code
GPD Project structure
Graphical Process Editor
Outcome
Maven project
Homework
Summary
75
79
88
91
95
95
99
100
[ iii ]
This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009
6393 south jamaica court, , englewood, , 80111
Table of Contents
Chapter 4: jPDL Language
jPDL introduction
jPDL structure
Process structure
GraphElement information and behavior
NodeCollection methods
ProcessDefinition properties
Functional capabilities
Constructing a process definition
Adding custom behavior (actions)
Nodes inside our processes
ProcessDefinition parsing process
Base node
Information that we really need to know about each node
Node lifecycle (events)
Constructors
Managing transitions/relationships with other nodes
Runtime behavior
StartState: starting our processes
EndState: finishing our processes
State: wait for an external event
Decision: making automatic decisions
Transitions: joining all my nodes
Executing our processes
Summary
Chapter 5: Getting Your Hands Dirty with jPDL
How is this example structured?
Key points that you need to remember
Analyzing business requirements
Business requirements
Analyzing the proposed formal definition
Refactoring our previously defined process
Describing how the job position is requested
Environment possibilities
Standalone application with jBPM embedded
Web application with jBPM dependency
Running the recruiting example
Running our process without using any services
Normal flow test
Summary
101
101
103
104
106
106
106
107
108
110
110
111
112
116
116
117
117
119
122
125
126
128
131
132
137
139
140
140
141
141
145
147
151
153
153
154
155
155
156
158
[ iv ]
This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009
6393 south jamaica court, , englewood, , 80111
Table of Contents
Chapter 6: Persistence
Why do we need persistence?
Disambiguate an old myth
Framework/process interaction
Process and database perspective
Different tasks, different sessions
Configuring the persistence service
How is the framework configured at runtime?
Configuring transactions
User Managed Transactions (UMT)
What changes if we decide to use CMT?
Some Hibernate configurations that can help you
Hibernate caching strategies
Two examples and two scenarios
Running the example in EJB3 mode
Summary
159
160
161
161
164
167
169
173
174
175
176
176
177
177
181
183
Chapter 7: Human Tasks
185
Introduction
What is a task?
Task management module
Handling human tasks in jBPM
Task node and task behavior
186
186
188
189
191
TaskNode.java
Task.java
TaskInstance.java
193
193
194
Task node example
Business scenario
194
194
Assigning humans to tasks
199
Managing our tasks
202
Real-life scenario
Users and tasks interaction model
203
205
Practical example
Setting up the environment (in the Administrator Screen)
It's time to work
207
207
211
Summary
215
userScreen.jsp
UserScreenController.java
taskCheckDeviceForm.jsp
TaskFormController.java
Chapter 8: Persistence and Human Tasks in the Real World
Adding persistence configuration
Using our new configurations
212
213
214
214
217
218
219
[]
This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009
6393 south jamaica court, , englewood, , 80111
Table of Contents
Safe points
Advantages of persisting our process during wait states
Persistence in the Recruiting Process example
Human tasks in our Recruiting Process
Modifying our process definitions
Analyzing which nodes will change
Modified process definitions
Variable mappings
Task assignments
222
226
228
228
229
230
231
232
234
Summary
240
Assignments in the Recruiting Process example
Chapter 9: Handling Information
Handling information in jBPM
Two simple approaches to handle information
Handling process variables through the API
ContextInstance proposed APIs
ExecutionContext proposed APIs
Telephone company example
Storing primitive types as process variables
How and where is all this contextual information stored?
How are the process variables persisted?
Understanding the process information
Types of information
Variables hierarchy
Accessing variables
Testing our PhoneLineProcess example
Storing Hibernate entities variables
Homework
Summary
Chapter 10: Going Deeply into the Advanced Features of jPDL
Why do we need more nodes?
Fork/join nodes
The fork node
The join node
238
241
242
244
245
245
247
248
251
252
252
257
258
260
261
262
264
266
266
267
267
268
268
271
Modeling behavior
Super state node
271
274
Process state node
281
Phase-to-node interaction
Node in a phase-to-phase interaction
Node-to-node interaction between phases
Complex situations with super state nodes
Navigation
277
278
278
279
279
[ vi ]
This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009
6393 south jamaica court, , englewood, , 80111
Table of Contents
Mapping strategies
285
The e-mail node
Advanced configurations in jPDL
Starting a process instance with a human task
Reusing actions, decisions, and assignment handlers
286
287
287
288
Summary
293
Properties
Bean
Constructor
Compatibility
Chapter 11: Advanced Topics in Practice
Breaking our recruiting process into phases
Keeping our process goal focused with process state nodes
What exactly does this change mean?
Sharing information between processes
Create WorkStation binding
289
290
291
292
295
295
299
301
302
302
Asynchronous executions
Synchronous way of executing things
The asynchronous approach
304
304
307
What happens if our server crashes?
Configuring and starting the asynchronous JobExecutor service
Different situations where asynchronous nodes can be placed
Summary
308
310
313
317
How does this asynchronous approach work?
307
Chapter 12: Going Enterprise
319
Index
341
jBPM configurations for Java EE environments
JBoss Application Server data source configurations
Taking advantage of the JTA capabilities in JBoss
Enterprise components architecture
The CommandServiceBean
JobExecutor service
JobExecutor service for Java EE environments
Timers and reminders
Mail service
Calendar
Timers
How do the timers and reminders work?
Summary
319
321
324
325
327
330
331
332
334
335
337
339
340
[ vii ]
This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009
6393 south jamaica court, , englewood, , 80111
This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009
6393 south jamaica court, , englewood, , 80111
Preface
You are reading this because you are starting to get interested in the open source
world. This book is especially for Java architects and developers with a free mind,
who want to learn about an open source project. The fact that jBPM is an open source
project gives us a lot of advantages, but it also comes with a big responsibility. We
will talk about both—all the features that this great framework offers us and also all
the characteristics that it has, being an open source project.
If you are not a Java developer you might find this book a bit harder, but it will give
you all the points to understand how the open source community works.
I would like to take you through my own history, about how I discovered jBPM so
that you can identify your situation right now with mine. Take this preface as an
introduction to a new field—integration. It doesn't matter what your programming
skills, experiences, and likes (user interfaces, code logic, low level code, simple
applications, enterprise applications, so on) are, if you are a courageous developer
you will like to tackle down all types of situations at least once.
With the myriad of web technologies these days, it's not a surprise that the new
developers' generation starts building web applications. I have been working in the
software development field for approximately six years now. I used to spend most
of my time creating, developing, and designing web-based applications. I have also
learned more "low level" languages such as C and C++, but in the beginning I could
not make money with that. So, PHP and JSP were my first options. Although it was
challenging I realized that I could not create bigger projects with my knowledge
about JSP and PHP. The main reason for this, in my opinion, is that bigger projects
become unmanageable when you start having web pages that contain all your
application logic. At that point I recognized that I needed to learn new paradigms
in order to create bigger and scalable applications. That is when I switched to Java
Enterprise Edition (version 1.4), which provides us with a componentized way to
build applications in order to be able to scale and run our applications on clusters
and with all these features about high availability and fault tolerance. But I was
not interested in configuring and making environmental settings, I just wanted
This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009
6393 south jamaica court, , englewood, , 80111
Preface
to develop applications. An important point in my career was when I started
getting bored as I had to spend hours with HTML and CSS frontend details that
I did not care about. So, I looked for other frameworks like JSF, which provides
a componentized way to build UIs and newer frameworks like JBoss Seam/web
beans (JSR-299) that have intimate relationships with the EJB3 specification, but
once again I had to check for HTML and CSS details for end users. I think that the
fact that I used to get bored with HTML and CSS is one of the biggest reasons why
I got interested in integration frameworks. When I use the word integration, I mean
making heterogeneous applications work together. Most of the time when you are
doing integrations; the user interfaces are already done and you only need to deal
with backends and communication stuff. That was my first impression, but then
I discovered a new world behind these frameworks. At this point two things got
my attention: the open source community and the theoretical background of the
framework. These two things changed my way of thinking and the way I used to
adapt to a new open source framework. This book reflects exactly that. First we'll
see how we can adapt all the theoretical aspects included in the framework and
then move on to how we can see all these concepts in the framework's code. This is
extremely important, because we will understand how the framework is built, the
project direction, and more importantly how we can contribute to the project.
I have been involved with the open source community for two years now, working
with a lot of open source frameworks and standards that evolve every day. When
I got interested in jBPM I discovered all the community work that is being done to
evolve this framework. I wanted to be part of this evolution and part of this great
community that uses and creates open source frameworks. That is one of the
main reasons why I created a blog (http://salaboy.wordpress.com) and
started writing about jBPM, I also cofounded the JBoss User Group in Argentina
(http://www.jbug.com.ar) and now Plug Tree (http://www.plugtree.com), an
open source-based company. With these three ventures I encourage developers to
take interest in new frameworks, new technologies and the most important thing,
the community.
What this book covers
Chapter 1, Why Developers Need BPM? introduces you to the main theoretical
concepts about BPM. These concepts will lead you through the rest of the book. You
will get an idea of how all the concepts are implemented inside the jBPM framework
to understand how it behaves in the implementations of the projects.
Chapter 2, jBPM for Developers, introduces the jBPM framework in a
developer-oriented style. It discusses the project's main components and
gets you started with the code distribution.
[]
This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009
6393 south jamaica court, , englewood, , 80111
Preface
Chapter 3, Setting Up Our Tools, teaches you to set up all the tools that you will be
using during this book. Basic tools such as Java Development Kit and the Eclipse IDE
will be discussed. It will also provide you with a brief introduction to Maven2 here
to help you understand how to build your projects and the framework itself. At
the end of this chapter you will see how to create simple applications that use the
jBPM framework.
Chapter 4, jPDL Language, introduces the formal language to describe our business
processes. It gives you a deep insight in to how this language is structured and how
the framework internally behaves when one of these formal definitions is used.
Chapter 5, Getting Your Hands Dirty with jPDL, gets you started with working on
real-life projects. You will be able to create your first application that uses jBPM
and define simple processes, using the basic words in the jPDL language.
Chapter 6, Persistence, sheds light on the persistence service inside the jBPM
framework, which is one of the most important services to understand in order to
create real-life implementations using this framework. The persistence services are
used to support the execution of long-running processes that represent 95% of
the situations.
Chapter 7, Human Tasks, describes the human interactions inside business processes,
which are very important because humans have specific requirements to interact
with systems and you need to understand how all this works inside the framework.
Chapter 8, Persistence and Human Tasks in the Real World, mainly covers configurations
to be done for real environments where you have long-running processes that
contain human interactions. If you think about it, almost all business processes
will have these requirements, so this is extremely important.
Chapter 9, Handling Information, helps you to understand how to handle all the
process information needed by human interactions inside the framework, as the
human interactions' information is vital to get the activities inside our business
processes completed.
Chapter 10, Going Deeply into the Advanced Features of jPDL, analyzes the advanced
features of the jPDL language. This will help you improve your flexibility to model
and design business processes, covering more complex scenarios that require a more
advanced mechanism to reflect how the activities are done in real life.
Chapter 11, Advanced Topics in Practice, provides us with practical examples on the
topics discussed in the previous chapters. This will help you to understand how all
the advanced features can be used in real projects.
[]
This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009
6393 south jamaica court, , englewood, , 80111
Preface
Chapter 12, Going Enterprise, introduces the main features provided by jBPM to run
in enterprise environments. This is very important when your projects are planned
for a large number of concurrent users.
Who this book is for
This book is mainly targeted at Java developers and Java architects who need
to have an in-depth understanding of how this framework (jBPM) behaves in real-life
implementations. The book assumes that you know the Java language well and also
know some of the widely-used frameworks such as Hibernate and Log4J. You should
also know the basics of relational databases and the Eclipse IDE. A brief introduction
to Maven2 is included in this book but prior experience might be needed for more
advanced usages.
Conventions
In this book, you will find a number of styles of text that distinguish between
different kinds of information. Here are some examples of these styles, and an
explanation of their meaning.
Code words in text are shown as follows: "As you can see, inside the
tags different tasks ( tag) can be defined."
A block of code is set as follows:
public class MyAssignmentHandler implements AssignmentHandler {
public void assign(Assignable assignable, ExecutionContext
executionContext) throws Exception {
//Based on some policy decides the actor that needs to be
// assigned to this task instance
assignable.setActorId("some actor id");
}
}
When we wish to draw your attention to a particular part of a code block, the
relevant lines or items are set in bold:
One
Initial Interview
...
[]
This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009
6393 south jamaica court, , englewood, , 80111
Preface
Any command-line input or output is written as follows:
mvn clean install -Dmaven.test.skip
New terms and important words are shown in bold. Words that you see on
the screen, in menus or dialog boxes for example, appear in the text like this:
"If we take a look at the Source tab, we can see the generated jPDL source code."
Warnings or important notes appear in a box like this.
Tips and tricks appear like this.
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about
this book—what you liked or may have disliked. Reader feedback is important for
us to develop titles that you really get the most out of.
To send us general feedback, simply send an email to feedback@packtpub.com,
and mention the book title via the subject of your message.
If there is a book that you need and would like to see us publish, please send
us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail
suggest@packtpub.com.
If there is a topic that you have expertise in and you are interested in either writing
or contributing to a book on, see our author guide on www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to
help you to get the most from your purchase.
[]
This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009
6393 south jamaica court, , englewood, , 80111
Preface
Downloading the example code for the book
Visit http://www.packtpub.com/files/code/5685_Code.zip to
directly download the example code.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes
do happen. If you find a mistake in one of our books—maybe a mistake in the text or
the code—we would be grateful if you would report this to us. By doing so, you can
save other readers from frustration, and help us to improve subsequent versions of this
book. If you find any errata, please report them by visiting http://www.packtpub.
com/support, selecting your book, clicking on the let us know link, and entering the
details of your errata. Once your errata are verified, your submission will be accepted
and the errata added to any list of existing errata. Any existing errata can be viewed by
selecting your title from http://www.packtpub.com/support.
Piracy
Piracy of copyright material on the Internet is an ongoing problem across all media.
At Packt, we take the protection of our copyright and licenses very seriously. If you
come across any illegal copies of our works, in any form, on the Internet, please
provide us with the location address or web site name immediately so that we
can pursue a remedy.
Please contact us at copyright@packtpub.com with a link to the suspected
pirated material.
We appreciate your help in protecting our authors, and our ability to bring you
valuable content.
Questions
You can contact us at questions@packtpub.com if you are having a problem with
any aspect of the book, and we will do our best to address it.
[]
This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009
6393 south jamaica court, , englewood, , 80111
Why Developers Need BPM?
I will start this book with a sentence that I say every time that I talk about jBPM.
"jBPM is a framework, keep it in mind". That's it, this is all that developers and
architects want to know to be happy, and it keeps them excited during the talks. For
this reason, the aim of the book is to give all developers an in-depth understanding
of this excellent, widely-used, and mature framework.
In this chapter we will cover the following topics:
•
Business process definition and conceptual background
•
Business process management discipline and the stages inside it
•
Business process management systems
To give you a brief introduction to this chapter, we are going to explain why
developers need to know about BPM and when they should use it. Before reaching
to this important conclusion we are going to analyze some new concepts like business
process, business process management discipline, and business process management systems
because it's important that developers manage the specific terminology pretty well.
Bearing these new concepts in mind, you will be able to start analyzing how your
company handles everyday work, so you can rediscover your environment with a
fresh perspective.
This chapter deals with vital conceptual topics that you need to know in order
to start off on the right foot. So, do not get disappointed if you feel that this is all
about theoretical stuff. Quite the opposite, just think that with all this conceptual
introduction, you will know, even before using the framework, why and how it
gets implemented as well as the main concepts that are used to build it internally. I
strongly recommend reading this chapter even if you don't know anything or if you
don't feel confident about the BPM discipline and all the related concepts. If you are
an experienced BPM implementer, this chapter will help you to teach developers the
BPM concepts, which they need in order to go ahead with the projects that will be
using it. Also if you are familiar with other BPM tools, this chapter will help you to
This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009
6393 south jamaica court, , englewood, , 80111
Why Developers Need BPM?
map your vision about BPM with the vision proposed by the jBPM team. Because it's
a vast theoretical topic, it is important for you to know the terminology adopted by
each project reducing and standardizing the vocabulary.
The moment you get to the concepts that we are going to see in this chapter, you will
get a strange feeling telling you: "Go ahead, you know what you are doing". So you
can take a deep breath, and brace yourself to get your hands on planning actions
using the concepts discussed in this chapter. Because these concepts will guide you
through till the end of this book.
First things first, we will start with business process definition, which is a main
concept that you will find in everyday situations. Please take your time to discuss the
following concepts with your partners to get an insight to these important concepts.
Business Process, why should I know
about that?
As you can see, jBPM has Business Process (BP) in the middle; so, this must be
something very important. Talking seriously, Business Process is the first key
concept to understand what we are really going to do with the framework. You
must understand why and how you describe these Business Processes and discover
the real application of this concept.
A common definition of Business Process is: Business Process is a sequence of tasks that
happen in a repeatable order, executed by humans and/or systems to achieve a business goal.
To understand this definition we need to split it into three pieces and contrast it with
a real example.
"A sequence of tasks that happen in a
repeatable order"
This definition shows us two important points:
1. First of all, the word "task", sounds very abstract. For learning purposes we
can say that a task is some kind of activity in the company, atomic in the
context, which contributes towards obtaining/completing some business
goal. In real world a task (or an activity if you prefer) could be:
°
Signing a contract
°
Hiring a new employee
°
Reviewing a document
[]
This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009
6393 south jamaica court, , englewood, , 80111
Chapter 1
°
Paying a bill
°
Calculating a discount
°
Backing up a file
°
Filling a form
As you can see, these examples are concrete, and the rule of thumb is
that these tasks should be described with an action (verb in the sentence,
Reviewing for example) and a noun (document in this case) that represents
where the action is applied.
Developers and architects should avoid thinking that "call myMethod()"
will be a good example of a task in a Business Process. Because this is not!
"call myMethod()" does not have anything to do with the business field.
Also remember that this is a conceptual definition and is not related to
any particular technology, language, or system.
The second important word that we notice is "sequence", which demands a logical
order in which the actions are executed. This kind of sequence in real scenarios could
be seen as: Buyer buys an Item -> Buyer pays the bill -> Dispatch buyer the order. An
important thing to note here is that this sequence does not change in a short period
of time. This means that we can recognize a pattern of work and an interaction that
always occurs in the same order in our company to achieve the same business goals.
This order could change, but only if we suffer changes in business goals or in the
way that we accomplish them. Also you can see that this sequence is not achieved by
one person; there is some kind of interaction/collaboration among a group of people
to complete all the activities.
"executed by humans and/or systems"
Here we will see who performs these activities. But probably you have a question,
why definition makes these distinctions about humans and/or systems? This is
because humans behave differently from systems. Human beings are slow (including
me) and machines are fast, so we need to handle this interaction and coordination
carefully. Why are humans slow? From the application perspective, this is because
when a task is assigned to a human being, let's say Paul, this task must wait for Paul
to be ready to do the job. In case Paul is on vacation for a month, the task would
have to wait for one month to begin. Systems (also called automatic procedures)
on the other hand, just execute the action as fast as they can, or when the action is
required. These two opposite behaviors are one of the principal influences in the
design of the framework. For this reason, we are going to see how these behaviors
are implemented inside the framework in the following chapters.
[]
This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009
6393 south jamaica court, , englewood, , 80111
Why Developers Need BPM?
Another important thing to keep in mind about these two behaviors is: ''waiting
for humans to respond'' and ''executing it as fast as possible for systems'', are the
behaviors that we will need to synchronize. In real-life situations, we will have them
in a random order. (The order could be somewhat like: wait, execute as fast as you
can, wait, wait, execute as fast as you can, and so on) Let's clarify these points with
a practical, real-world example. Imagine that we are in a company called Recycling
Things Co. In one of the company branches papers are recycled. This branch of the
company is in charge of recycling used paper, processing it, and storing it until
someone buys it. Probably this process contains the following activities/tasks:
1. Receiving X ton(s) of a pile of paper in the "Just received" warehouse—here,
we probably have a guy (the "Just received" guy), who fills in a form the
specifics like the type of paper, the weight, and other technical details
about it upon receiving something each time. When he finishes the form, he
receives the paper pile and stores it in the warehouse. Finally, he sends the
form to the main offices of Recycling Things Co.
2. The form filled in the "Just received" warehouse arrives at the main office of
Recycling Things Co., and now we know that we can send X ton(s) of paper
to the recycling station. So, we send the X ton(s) of paper from "Just received"
warehouse to the recycling station. Probably we do that by just making a call
to the warehouse or filling another form.
3. When the pile of paper arrives at the recycling station, an enormous machine
starts the process of recycling. Of course, we must wait until this big machine
finishes its job.
4. The moment the machine finishes, the guy in charge of controlling the
outcome of this machine (Recycling Station guy), checks the status of the
just-recycled paper and, depending on the quality of the outcome he decides
to reinsert the paper into the machine again or to move the finished paper
to the "Just finished" warehouse. Just after that he fills in a form to report
to the main office of Recycling Things Co. that the X ton(s) of papers were
successfully recycled, and includes also the number of iterations he needed
to perform with the required level of quality to get the job done in the form.
Probably this level of quality of the recycled paper will also be included on
the form, because it is valuable information.
5. When the guy from the "Just finished" warehouse receives the recycled
X ton(s) of paper, he also sends a form to Recycling Things Co. main
offices to inform them that X ton(s) of paper are ready to sell.
To have a clear understanding of this example, we can graph it, in some
non-technical representation that shows us all the steps/activities in our
just-described process. One of the ideas of this graph is that the client, in this
case Recycling Things Co. manager, can understand and validate that we are
on the right track regarding what is happening in this branch of the company.
[ 10 ]
This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009
6393 south jamaica court, , englewood, , 80111
Chapter 1
Used Paper arrives
Store used paper
Fill and Send Form to
Main Offices
Just Received
Warehouse
Form Arrives
Call to the Recycling
Station
Main
Offices
Receive Call
Move the paper to
recycling station
Recycle Paper in Big
Machine
Recycling
Station
No
Quality Check
Pass?
Yes
Fill and Send Form to
Main Offices
Form Arrives
Call to Just Finished
Warehouse
Main
Offices
Receive Call
Move and Send Form to
Main Offices
Just Finished
Warehouse
Fill and Send Form to
Main Offices
As you can see, the process looks simple and one important thing to notice is that
these chained steps/activities/tasks are described from a higher-level perspective,
like manager level, not employee perspective. It is also necessary to clarify the
employee perspective and add this detail to each activity. We need to have a
clear understanding of the process as a whole, the process goal, and the details
of each activity.
[ 11 ]
This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009
6393 south jamaica court, , englewood, , 80111
Why Developers Need BPM?
If you are trying to discover some processes in your company, first ask at
manager level, they should have a high-level vision like in the Recycling
Things Co. example. Then you should know what is going on in everyday
work. For that, you should ask every person involved in the process about
the activities that they are in charge of. In a lot of companies, managers
have a different vision of what is going on everyday. So ask both sides,
and remember employees have the real process in their minds, but they
don't have full visualization of the whole process. Pay close attention
to this. Also remember that this kind of discovering task and modeling
process is a business analyst's job.
"to achieve a business goal"
It is the main goal of our jobs, without this we have done nothing. But be careful,
in most cases inexperienced developers trying to make use of their new framework
forget this part of the definition. Please don't lose your focus and remember why
you are trying to model and include your processes in your application. In our
previous example, Recycling Things Co., the business goal of the process (Recycle
paper) is to have all the recycled papers ready as soon as possible in order to sell it.
When the company sells this paper, probably with another process (Sell recycled
paper), the company will get some important things: of course money, standardized
process, process formalization, process statistics, and so on. So, stay focused on
relevant processes that mean something to the company's main goal. Try not to
model processes everywhere because you can. In other words, let the tools help you;
don't use a tool because you have it, but because it's in these situations where all the
common mistakes happen.
I know what BPs are, but what about the final
"M" in BPM?
If we have a lot of business processes, we will need to manage them over time. This
means, that if we have too many process definitions, and also we have executed
these definitions, we will probably want to have some kind of administration that
lets us store these definitions as well as all the information about each execution. You
may also want to keep track of all the modifications and execution data throughout.
This is really necessary because the process will surely change and we need to
adapt to the new requirements of our business that evolves each day. That is why
Business Process Management (BPM) emerges as a discipline to analyze, improve,
automatize, and maintain our business processes. This discipline proposes four
stages that iteratively let us have our business processes in perfect synchronization
with business reality.
[ 12 ]
This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009
6393 south jamaica court, , englewood, , 80111
Chapter 1
BPM stages
Now we are going to analyze the stages that this discipline proposes to us:
1. Finding/discovering real-life process: In this stage, business analysts try
to find business processes in the company. Depending on the methodology
used by the analysts to find a process, probably we will get some description
about the activities in the process. Most of the time these processes can be
found by asking company managers and employees about the goals of the
various processes and the activities needed to fulfill them. This will also give
us a list of all the business roles involved in each process.
2. Designing/modeling process: If we start with the description that business
analysts carry out in the previous state, this stage will try to represent
this definition in some formal representation/language. Some, in vogue
languages to do that are BPMN (Business Process Modeling Notation) and
XPDL (XML Process Definition Language), these languages are focused in
an easy graph representation of these processes and an intuitive and quick
understanding of what is happening in each of them. The goal of this stage
is that all the people who are in contact with this formal representation
understand the process well and know how the company achieves the
process business goal.
3. Executing process: This is one of the most interesting stages in BPM (at least
for us), because here our process definitions come to life and run, guiding the
work that the company is doing everyday. With this guidance the company
gains all the advantages discussed in the next section. The goal of this stage
is to improve the process execution times and performance and to make the
systems and people communication between people and systems smoother
in order to achieve the business goal.
4. Improving process: At this point, with processes already executed, we try
to analyze and find some improvements to our processes. This is achieved
by analyzing the execution data and trying to reduce the gap between the
formal definition of the process and the actual implementation style of our
company. Also, we try to reduce and find possible bottlenecks and analyze
if there are some activities that can be done simultaneously, or if we have
unnecessary activities, or if we need to add new activities to speed up our
process performance.
[ 13 ]
This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009
6393 south jamaica court, , englewood, , 80111
Why Developers Need BPM?
As you can imagine, all these stages are iteratively repeated over time. Take a look
at the following figure that shows us all the BPM stages. It also includes the most
common artifacts that are generated in each step.
Business Users
Business
Analysts
Manager Employees
DISCOVERING
PROCESS
Process
textual
description
Business
Analysts
IMPROVING
PROCESS
Business
Analysts