JBoss jBPM 3 is a flexible, extensible framework for process languages which uses graph oriented programming as a foundation. As the word says it, a graph based language represent some kind of execution which can be shown as a graph (Imagine a simple flow chart which explains the track of a business decision for example).
Business process management can be defined as a procedure in an organization: some of this procedures can be automated, some need human work.
Why we need a BPM in Java ?
the basic of an interaction with other systems is the exchange of information/messages
Response r = waitForResponseFromB();
What is the limitation with this ? the first limitation is that by itself this little code is not persistable, yes of course you can wrap it with some Object/Relational tool...but what about waiting states ? even if you implement it as a Thread you cannot persist a Java Thread.
The second one is that you might need a graphical representation of this......for example your Boss wants to take a look at your process...or even more, what about if business changes ? without a native graphical implementation of the process you have to do double work: re-engineering the Code and the Graph with your favourite tool.
So now let's get our hand dirty ! The first thing to do is to download a fresh copy of JBPM fron jBoss site. For this article we'll use jbpm-jpdl-suite-3.2.3.zip downloadable from www.jboss.org site.
This archive includes embedded application server (JBoss of course) and the graphical designer. Before entering in the details let's make clear one thing: usually BPM engines have a tight coupling with the graphical environment : meaning you have to use the graphical editor to draw or change your process. JBPM is basically a process management Api built on Hibernate (which maps the basic workflow tables) and it can live well without any graphical editor. It does exists a plugin built with Eclipse technology which lets you reverse-engineer your graphical process into an XML file, yet you can still design your process with a simple notepad and a Java compiler.
So keep separated the concept of the Graphical Process Designer (GPD), which will be used by analyst/ top managers to describe the process and the process it self which is only xml and pure Java. Nice separation of tasks between analysts and developers isn't it ?
So we talked about XML: what is the process language of jBPM? there are more then one but just for beginning we'll concentrate on the most common: that is jPDL. JPDL is an XML structured language which has a specific process grammar to describe process definitions, nodes and transitions.
Meanwhile you read this article I guess you have finished downloading jbpm-jpdl-suite-3.2.3.zip. So unzip it and launch the designer.bat (or designer.sh for Unix/Linux users) under the "designer" folder.
Once Eclipse is started, launch the "New..." Menu and select new Process project
Then choose a convenient name for your Project and wait until you'll see your Project in the Package explored. Resist one more minute before looking at your process: open the JBPM library tag in the Package explorer: you'll see the libraries needed to run your process from a standalone application. Quite a lot, isn't it ? but only two of them are the core jBPM libraries, all the others are just dependancies.
So if you plan to run your application on a JBoss application server these 2 are the only libraries you'll need to add to your war/ear file. We'll start with a simple process which describes an order management system.
The process is quite straightforward : once the process is started we meet a Task Node: in short a task node represents an activity that is performed by humans. This task will be in charge of user "buyer".
Once the order is performed we have a Decision Node where the process can lead to different Nodes based on the data at its disposal. In our case we check if the goods ordered are available. If they're not available the process is switched to a State Node named "GetFromStock". A State Node simply tells the process instance to wait and, in contrast to a task node, it doesn't create an activity in anybody's task list.
At last our goods needs to be shipped and this will be another task in charge to our Deliver Office. Once also this task is completed our process will come to a end.
- Next >>