Newsletter sign-up
View all newsletters

Sign up for our technology specific newsletters.

Enterprise Java
Email Address:

Manage your business processes with JBoss jBPM

Get started using JBoss's business process management tool

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone

Page 3 of 4

Figure 2. The jBPM graphical modeling designer. Click on thumbnail to view full-sized image.

The graphical designer can be used to create process definitions, attach action handlers to events, edit definition source, create process archives, test process definitions, and so on.

Deploying JBoss jBPM

JBoss jBPM stores process definitions in a database. Therefore, deploying a process into JBoss jBPM involves parsing the process-definition.xml and storing it in the JBoss jBPM database. This can be done by:

  • Using the par Ant task supplied with JBoss jBPM to create a process archive.
  • Using the deploypar utility. This utility also creates a process archive and deploys the process archive to the jBPM database. The deploypar utility takes a jBPM.properties file as an attribute. This file specifies configuration options, including the database to which the process archive is to be deployed.
  • Programmatically parsing and storing the process-definition.xml into a datastore.


Running JBoss jBPM through some simple paces

JBoss jBPM acts as an orchestration engine that sits in the middle of enterprise applications, enabling integration and coordination between different applications.

For this article, I use the sample deployment shipped with jBPM to discuss how jBPM and jPDL are used to create and modify a simple Web-enabled order processing system.

Downloading JBoss jBPM

The JBoss jBPM starter kit contains everything needed to execute JBoss jBPM, with the exception of a JDK. The JBoss Application Server in the JBoss jBPM starter kit requires J2SE 1.4 or a more recent version.

After you have downloaded the starter kit, unzip it to a directory of your choosing. Once you have unzipped the starter kit, you will have a directory structure similar to the following:

  • Jbpm-starters-kit-3.1
    • jbpm: Contains the source code for the JBoss jBPM product
    • jbpm-bpel: Contains information about the BPEL extension for JBoss jBPM
    • jbpm-db: Contains sample configurations for connecting JBoss jBPM to other databases
    • jbpm-designer: Contains the Eclipse plug-in for the JBoss jBPM Visual Process Designer
    • jbpm-server: Contains the JBoss Application Server along with the JBoss jBPM engine and the sample process

Execute the JBoss jBPM engine

To start the JBoss application server with jBPM deployed, go to the jbpm-server directory and execute the startup script found there. A command window should pop up with the jBPM console window, similar to Figure 3.

Figure 3. The jBPM console window. Click on thumbnail to view full-sized image.

Now, bring up a browser window and go to http://localhost:8080/jbpm. You will be presented with the login page for the sample Web application for JBoss jBPM, shown in Figure 4.

Figure 4. The JBoss jBPM Web application login page. Click on thumbnail to view full-sized image.

Log in as cookie monster and select the Create New Web Sale Order link. This will create a new instance of the prebuilt "Web sale" process, illustrated in Figure 5.

Figure 5. Web sale process definition. Click on thumbnail to view full-sized image.

The actual definition file, processdefinition.xml, is located in websale.par and is illustrated in the following listing:

 <?xml version="1.0"?>

<process-definition name="websale" xmlns="urn:jbpm.org:jpdl-3.1">

<!-- SWIMLANES (= process roles) -->

<swimlane name="buyer" /> <swimlane name="salesman"> <assignment expression="user(ernie)" /> </swimlane> <swimlane name="accountant"> <assignment expression="user(bert)" /> </swimlane> <swimlane name="shipper"> <assignment expression="user(grover)" /> </swimlane> <!-- NODES -->

<start-state name="create new web sale order"> <task swimlane="buyer"> <controller> <variable name="item"/> <variable name="quantity"/> <variable name="address"/> </controller> </task> <transition to="evaluate web order" /> </start-state> <task-node name="evaluate web order"> <task swimlane="salesman"> <timer duedate="20 seconds" repeat="10 seconds"> <action class="org.jbpm.websale.RemindActor"> <swimlaneName>salesman</swimlaneName> </action> </timer> <controller> <variable name="item" access="read"/> <variable name="quantity" access="read"/> <variable name="address" access="read"/> <variable name="comment"/> </controller> </task> <transition name="ok" to="salefork" /> <transition name="more info needed" to="fix web order data" /> </task-node>



<task-node name="fix web order data"> <task swimlane="buyer"> <controller> <variable name="comment" access="read"/> <variable name="item" /> <variable name="quantity" /> <variable name="address" /> </controller> </task> <transition to="evaluate web order" /> </task-node>

<fork name="salefork"> <transition name="payment" to="wait for money" /> <transition name="shipping" to="ship item" /> </fork> <task-node name="wait for money"> <task swimlane="accountant"> <controller> <variable name="item" access="read" /> <variable name="quantity" access="read" /> <variable name="address" access="read" /> <variable name="money received" /> </controller> </task> <transition to="update books" /> </task-node> <node name="update books"> <action class="org.jbpm.websale.UpdateBooks"> <msg>accountancy application is now informed of the payment</msg> </action> <transition to="salejoin" /> </node> <node name="ship item"> <action class="org.jbpm.websale.ShipItem"> <swimlaneName>shipper</swimlaneName> <msg>${shipper} now ships ${item} to ${address}</msg> </action> <transition to="salejoin" /> </node> <join name="salejoin"> <transition to="end" /> </join>

<end-state name="end" />

</process-definition>


Once the Create New Web Sale Order page is loaded, fill out the Item and Quantity form fields with cookie as the item and 1 as the quantity. Then select Save and Close Task to complete the Create New Web Sale Order task. The Web application will signal jBPM to move the Web sale process token to the Evaluate Web Order task and apply the data entered as process variables. At this point, the login page displays again. You will notice a message that reads, "A new task has been assigned to 'ernie'."

Now, select the Login As Another User link and log in as ernie. You will notice that the Evaluate Web Order task is highlighted. Type need address into the comment field and select the More Info Needed button. This will move the process token to the Fix Web Order Data task and return the browser to the login page.

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone
Comments (5)
Login
Forgot your account info?

Jboss Rules TrainingBy Anonymous on September 7, 2009, 5:22 pmYou can try JBoss Rules Training http://www.nobleprog.co.uk/jboss+rules/training Hope it will help you

Reply | Read entire comment

JBOSSand JBPM integrationBy Anonymous on July 22, 2009, 5:55 amCan some one explain the steps to integrate JBPM with currently running jBOSS server? If any compatibility issues exists kindly throw some light on that as well?

Reply | Read entire comment

JBOSSand JBPM integrationBy Anonymous on July 22, 2009, 5:55 amCan some one explain the steps to integrate JBPM with currently running jBOSS server? If any compatibility issues exists kindly throw some light on that as well?

Reply | Read entire comment

jpdl modification at runtimeBy Anonymous on June 3, 2009, 12:32 pmhi, i am new in this field, someone knows if it is possible to modify the file process source at runtime in order to make the process more dynamic without having...

Reply | Read entire comment

how can test the workflow with a user and later with other?By Anonymous on October 9, 2008, 11:15 amif I created 2 users i supose that firts test with one user and later test the workflow with another?

Reply | Read entire comment

View all comments

Add comment
Anonymous comments subject to approval. Register here for member benefits.
Have a JavaWorld account? Log in here. Register now for a free account.
Resources