Mule 3.3 – jBPM Model Part 1

In this post I’d like to describe the integration between Mule (Release 3.3) and Business Process Model (BPM). I’m using a Jboss implementation named jBPM.

BPM is a very huge argument, we’ll try to speak about it and look at used in Mule ESB. This wouldn’t be a post about entire BPM. I’ll not so able to speak about it.

You need to know that I’ve always been fascinated by these types of system. One of my first project has been with Microsoft BizTalk (are you suprised that now I’m speaking about java ?) and I’m very happy speaking again about these arguments.

Now some FAQ:

What is Business Process Model? (

How does Mule get this integration? (

Is jBPM the only possible BPM integration engine with mule? Which version of BPM does Mule supported? ( Take a look of it “The latest version supported by Mule is jBPM 4.2“.

Let’s start to describe my business flow.  I have to decide if accept or refuse company’s orders . For this purpose we’ll check the order’s quantity. If this quantity is less than 100 I refuse the order; otherwise I accept it. Easy, not?

It’s available a graphic plugin for Eclipse and we’ll use it to design the Business Rule. This is the result:

How have we got this result? First you’ve to download the jbpm version 4.2 from jboss web site.

Once you have unzipped the files into a folder, you can install the plugin. Go to Help->Install new software and take the <source_jbpmdirectory>/install/src/gpd/ file.

Some next, next, next later you’ll able to create jBPM4 Process Definition from “New”  window.

Let’s proceed with the creation of the business process. A complete guide about the language (jPDL) is available here (

The xml source of our process is the follow:

<?xml version="1.0" encoding="UTF-8"?>

<process name="orderprocess" xmlns="">
	<mule-receive endpoint="toOrderprocess" name="receiveOrder" type="java.lang.String" var="orderid">
        <transition to="ProcessOrder"/>

   <decision g="206,180,48,48" name="orderDecision">
      <transition g="-62,-20" name="to RefuseOrder" to="RefuseOrder">
      	<condition expr="#{orderwarehouse.quantity &lt; 100}"/>
      <transition g="-66,6" name="to AcceptOrder" to="AcceptOrder">
      	<condition expr="#{orderwarehouse.quantity &gt;= 100}"/>

   <java class="it.matrix.samplemulejbpm.CheckOrder" g="17,179,92,52" method="processOrder" name="ProcessOrder" var="orderwarehouse">
   	<arg><object expr="#{orderid}"/></arg>
      <transition g="-39,-19" name="to orderDecision" to="orderDecision"/>

   <java class="it.matrix.samplemulejbpm.CheckOrder" g="317,245,92,52" method="acceptOrder" name="AcceptOrder">
   	<arg><object expr="#{orderwarehouse}"/></arg>
      <transition g="-74,-18" name="to orderResult" to="orderResult"/>

   <java class="it.matrix.samplemulejbpm.CheckOrder" g="316,116,92,52" method="refuseOrder" name="RefuseOrder">
   	<arg><object expr="#{orderwarehouse}"/></arg>
      <transition g="-75,-1" name="to orderResult" to="orderResult"/>
   <join g="506,176,48,48" name="orderResult">

	<mule-send endpoint="fromOrderprocess" exchange-pattern="one-way" expr="#{orderwarehouse}" name="sendToOutput">


I used a controller class named it.matrix.samplemulejbpm.CheckOrder.

package it.matrix.samplemulejbpm;

import java.util.HashMap;
import java.util.Map;

public class CheckOrder {
 private static final long serialVersionUID = 1L;
 Map<String, Order> warehouse = new HashMap<String, Order>()
   put("AZ-1265", new Order("AZ-1265", 100, 2011.9f));
   put("AZ-6522", new Order("AZ-6522", 10, 115.9f));
   put("AZ-8436", new Order("AZ-8436", 200, 500.10f));
 public String acceptOrder(Order payload)
  return payload.toString();
 public String refuseOrder(Order payload)
  return payload.toString();
 public Order processOrder(String payload)
  Order order = warehouse.get(payload);
  if (order == null)
   //Order not found
   order = new Order("0", 0, 0);
  return order;

And here the bean Order.

package it.matrix.samplemulejbpm;


public class Order implements Serializable {

 private static final long serialVersionUID = 7830120993371620210L;
 public String orderId;
 public int quantity;
 public float amount;
 private String response;
 public Order(String orderId,
     int quantity,
     float amount)
  this.orderId = orderId;  
  this.quantity = quantity;
  this.amount = amount;
 public String getOrderId() {
  return orderId;
 public void setOrderId(String orderId) {
  this.orderId = orderId;
 public int getQuantity() {
  return quantity;
 public void setQuantity(int quantity) {
  this.quantity = quantity;
 public float getAmount() {
  return amount;
 public void setAmount(float amount) {
  this.amount = amount;
 public String toString()
  return "orderId: " + orderId +
    " quantity: " + quantity +
    " amount: " + amount +
    " response:" + response ;

 public String getResponse() {
  return response;

 public void setResponse(String response) {
  this.response = response;


In the next part of this post I’ll show you how integrate this flow with Mule. Stay tuned.


2 thoughts on “Mule 3.3 – jBPM Model Part 1

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.