jBPM goes BPMN!

For those who follow the jBPM internal discussions a bit, the marriage of jBPM and BPMN will come as no surprise. Since this summer we’re coding away at a native BPMN2 implementation on top of our Process Virtual Machine (PVM), and you might have seen tweets or forum posts passing by where the term ‘BPMN’ pops up. However, the only proof were some classes in our SVN trunk …. until now!

In this post I’ll give you a sneak peek of our current BPMN2 execution effort which will be documented, QA’d and incorporated in the jBPM 4.3 release (scheduled January 1st). Many thanks go out to our community members Ronald Van Kuijk and Bernd Rücker, who have contributed a significant amount of  ideas and code (and in fact, still are contributing to the BPMN2 implementation now as we speak). This is open-source power at its fullest…

Happy times indeed!

What is BPMN2?

Basically, the Business Process Modeling Notation (BPMN) started out a pure graphical notation standard for business processes, maintained by the Object Management Group (OMG). Version 2.0, which currently is in beta, adds execution semantics to the specification and this is of course where it gets interesting for jBPM.

The primary benefit of BPMN2 is that it is a standard accepted by the IT industry, which means that process models become portable (graphical and execution-wise) across process engines such as jBPM. Since process executions are the raison-d-être of jBPM, it is only natural we are now investing in BPMN2. People who are familiar with JPDL (the current native language of jBPM) will have generally no difficulties in learning the BPMN2 language, as many constructs and concepts are shared. In fact, from a high-level point of view, BPMN2 and JPDL are in concept solving the same problem (which is a biiiiig difference with BPEL – but that’s a story I’ll let other tell).

Of course, this is just the nutshell explanation. You can find a lot more information in our wiki.

Enough talking … show me how it works!

The business process we’re going to implement looks as follows (click to enlarge – created using the wonderful editor from our friends at Signavio).

You might recognize this example, since we’ve also implemented it in JPDL as an example in our distribution.

The business process is simple: an employee can start a new process and make a request for a certain amount of vacation days. After the request task has been completed, the manager will find a verification task in its tasklist. The Manager can now decide to accept or reject this request. Depending on the outcome (that’s the little rhombus on the outgoing transitions, or better said ‘sequence flow’ as it is called in BPMN. It means that there is  a condition that must be true to follow it), a rejection message is send or the process ends.

As is the case with JPDL, BPMN2 uses an XML language to define the process definition. Our business process looks like this in BPMN2 XML:

<?xml version="1.0" encoding="UTF-8"?>
<definitions id="vacationRequest"
 xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 BPMN20.xsd"

 <process id="vacationRequestProcess" name="BPMN2 Example process">

   <startEvent id="start" />

   <sequenceFlow id="flow1" name="fromStartToRequestVacation"
     sourceRef="start" targetRef="requestVacation" />

   <userTask id="requestVacation" name="Request Vacation"
     <potentialOwner resourceRef="user" />
     <rendering id="requestForm">

   <sequenceFlow id="flow2"
     name="fromRequestVacationToVerifyRequest" sourceRef="requestVacation"
     targetRef="verifyRequest" />

   <userTask id="verifyRequest" name="Verify Request"
     <potentialOwner resourceRef="manager" />
     <rendering id="verifyForm">

   <sequenceFlow id="flow3" name="fromVerifyRequestToEnd"
       sourceRef="verifyRequest" targetRef="theEnd">
     <conditionExpression xsi:type="tFormalExpression">
        ${verificationResult == 'OK'}

   <sequenceFlow id="flow4"
       name="fromVerifyRequestToSendRejectionMessage" sourceRef="verifyRequest"
     <conditionExpression xsi:type="tFormalExpression">
        ${verificationResult == 'Not OK'}

   <scriptTask id="sendRejectionMessage" name="Send rejection Message"
       <![CDATA[System.out.println("Vacation request refused!");]]>

   <sequenceFlow id="flow5"
     name="fromSendRejectionMessageToEnd" sourceRef="sendRejectionMessage"
     targetRef="theEnd" />

   <endEvent id="theEnd" name="End" />


Most of the constructs are straightforward, certainly if you’re coming from a JPDL background. Do note that the Resource construct isn’t correctly implemented (yet), but that should be solved for the 4.3 release. Also note that you already can add taskforms to your user tasks (see line 33-35 for example).

Also interesting to note is the way how the outcome of the user task is used is for guiding the flow through the process (line 41 and 49). We could have used an exclusive gateway to do the same (which is also already implemented), but we’re using formal expressions on the outgoing sequence flows coming from the user task, just to show you we can.

That’s cool … but I’m a Java developer!

Rest assured: everything that makes jBPM a blessing to use is here to stay. Tom has put a tremendous effort in the jBPM PVM and we now are reaping the fruits of his work. BPMN2 is implemented on top of the PVM, which means that many things come for free: database persistency, database transactions, the service and query API’s, etc. it all just works.

So, when we want to test a business process, we use the same Java approach which we always had with jBPM:

public class VacationProcessTest extends JbpmTestCase {

  protected void setUp() throws Exception {

    NewDeployment deployment = repositoryService.createDeployment();

    String deployId = deployment.deploy();


  public void testRequestRejected() {

    ProcessInstance pi = executionService.startProcessInstanceByKey("vacationRequest");

    // After process start, peter (employee)
    // should be a candidate for the task
    Task requestTasktask = taskService.createTaskQuery()

    // After this task is completed,
    // a manager (eg alex) is be able to see a 'verify' task
    TaskQuery verifyTaskQuery = taskService.createTaskQuery()

    Task verifyTask = verifyTaskQuery.uniqueResult();

    // When completing the verification task,
    // we also need to store the result of the decision
    // (will be done through the taskform normally)
    Map<String, Object> vars = new HashMap<String, Object>();
    vars.put("verificationResult", "not OK");
    taskService.completeTask(verifyTask.getId(), vars);

    // With a rejection, we should see
    // the 'sendRejectionMessage' task in the history log
    HistoryActivityInstance hai = historyService.createHistoryActivityInstanceQuery()



So what you’re seeing here is

  • Testing BPMN2 business processes in pure Java code that everybody understands
  • in a way which is exactly the same as for JPDL
  • and using the very same API which we are all familiar with
  • and using the very same database schema as before!

What’s there not to like? In my opinion, the argument of the same API is really really really powerful. The PVM is showing its power at its fullest! To configure your jBPM installation for BPMN2, you just have to add this line to your jbpm.cfg.xml file:

<import resource="jbpm.bpmn.cfg.xml" />

Conclusion: using BPMN2 processes in your application with jBPM is extremely easy. Everything you know about embedding and configuring jBPM is just as before … except that you’re now using a portable and standard process language.

What else?

A lot. Just check our wiki to see what’s planned for the 4.3 release. When talking in pure BPMN2 constructs, these are all planned for next month: Exclusive Gateway (XOR), Parallel gateway (AND), Service Task (Java based), Manual Task, Receive Task (Java only), Script Task, User Task, None start event, None end event, Terminate end event, Sequence Flow, Conditional Sequence flow, Formal expression, Interface (Java), Resource + ResourceParameter. More is possible, if we go to bed a bit later than usual 😉

To finish this sneak peek, here is a screencast of our jBPM console executing the BPMN2 example process which is described above. In this screencast, you’ll see Peter (the employee) requesting 5 days of vacation using our business process. After he finishes the request task, he logs out. Mike, a manager, now logs in and finds the vacation request in his task list. He rejects the request since there is too much work. Peter will now be notified with a rejection message (for this demo, just a printout to the console). The forms you see are using the same taskform mechanism which I described earlier.

The last part of the screencast shows that the reporting functionality, which was already available for JPDL, also works for the BPMN2 processes. Even better, since the PVM defines a shared database schema, reports can aggregate data based on JPDL and BPMN2 processes without any problem!

Until next post!



  1. […] by Scott Francis Pretty interesting update from Joram Barrez on jBPM – looks like it now supports BPMN2.0. (or, more accurately, it will come January […]

  2. […] erstes lauffähiges (!) Beispiel hat Joram vom jBPM-Team auch bereits online gestellt: jBPM goes BPMN. Natürlich werden im ersten Schritt noch nicht alle BPMN 2.0 Features unterstützt, viel mehr wird […]

  3. Sebastian December 13, 2009

    Thank you for this great post, Joram!

  4. Rafael January 12, 2010

    Hello Joram,
    Congratulations for the new version, PVM running both standards seamlessly is really impressive!

    I am adding JBPM to an application and am very excited about the possibilities, but I have 2 problems I’m stuck with:
    – How can I import my Signavio 3.6.5 BPMN2 xmls into the eclipse plugin? Is it BPMN2 enabled?
    – I need to perform queries applying filters to my variables, is there a way to do this through the framework?



    ps. What would be the best forum for questions like these?

  5. Joram January 13, 2010

    @Rafael: The Eclipse plugin is not BPMN2 enabled (at the moment). For the query on variables, I believe that’s planned for the next release (4.4)

  6. Sebastian Schneider March 4, 2010

    What’s the reason for using and not ?

  7. Sebastian Schneider March 4, 2010

    What’s the reason for using custom tag names like userTask instead of the implementation-section to distinguish between different kind of tasks? Is this going to be changed?

  8. Joram March 5, 2010

    @Sebastian: userTask is not at all a custom tag name, bot a core tag of the spec. The default implementation attribute is webservice, which is a secondary use case for use, hence the ‘other’ usage.

  9. TommieBRIGGS July 23, 2010

    The business loans are very useful for guys, which are willing to ground their organization. In fact, it is not hard to receive a sba loan.

Leave a Reply

Your email address will not be published.