Tuesday, April 8, 2008

Book Review: Business Process Management with JBoss jBPM

Business Process Management with JBoss jBPM
A Practical Guide for Business Analysts, by Matt Cumberlidge

I have been working on Service Orchestration in JBossESB, using jBPM, and a few weeks back PACKT Publishing asked me to review the JBoss jBPM book. I have been reading it whenever I had a spare moment. I have to admit the book was not what I initially expected it to be. For some reason I thought the book would be an in depth text book about jBPM and it's features. It is not, well it's got some of that, but what it really is, is what the title already says: “Business Process Management with JBoss jBPM; A Practical Guide for the Business Analyst”. So I guess I skipped over the 'for the Business Analyst' part. However after actually reading the book, I think the author picked the right subject by explaining how to do a BPM project in the first place.

Truth be told I may have some idea about it, but I never read anything that formal on the matter, and the best part is that Matt simply follows a fictitious (or is it?) project about a record company called “Bland Records”. In Matt's words “Bland Records' specialty is in finding talentless, yet attractive youths, assembling them into bands of four or five, partnering the ready-made band with a songwriter and some real musicians, who finish the product with an addictive set of tunes. The end product is released on an unsuspecting public who promptly shoot the band to number one in the charts”.

The book is to the point and an easy read. The first few chapters are about what a Business Process actually is, what the interaction the Business Analyst and the Developer should be and how to set up interaction channels with the customer, how to put together the project team and how to find the right project sponsors to optimize the chances to deliver a successful product. In his book he sets up a workshop for the project team where the business process is analyzed and a flow diagram is created, before breaking for lunch. After lunch the team goes through the flow diagram to identify the roles and responsibilities. He goes over terminology like PID (Process Identification Document), SME (Subject Matter Experts) and RACI (Responsible, Accountable, Consulted, Informed), and how to use the RACI Matrix, and finishes by how to end up with a realistic implementation plan. I really enjoyed these two chapters.

Chapter 3 explains how to install jBPM and it gives a quick introduction to the product. The chapter has plenty of screenshots to keep you on track and you should get a good visual picture in your mind about jBPM capabilities, the chapter finishes by implementing the business process as a proof-of-concept system. Chapter 4 adds a user interface to the prototype and by the end of the chapter you have a fully functional system, for which you can get sign off from the client. This is a nice break point in the project where some wrinkles can get ironed out before putting more time into making the thing look nice. Chapter 5 speaks to how to deploy and setup the proof-of-concept and how to go through some iterations with the team. At this point the integration points with other systems should still be stubbed out. Finally, when the iterations have honed the business process implementation, another sign off follows and in Chapter 6 he describes how to convert the proof-of-concept to a production ready system and by setting up a BAM (Business Activity Monitor) to gather process metrics in production. At the end of chapter 6 the project goes to production and in chapter 7 the team comes together for a post mortem, where they try to evaluate the success of the project, and they try to come up with an ROI of the system. Assuming all is in order a final sign-off from the client can now be obtained. Over time the process metrics can be tracked and future projects may implement process change requests.

The book is a quick read and I think it very wise to hand out a copy to each of the members on your team when starting a BPM project. The price may be a little steep, but part of it goes to the jBPM project and I'm sure those costs can be expensed on the project anyway ;). Thumbs up on this one.

Monday, March 17, 2008

Using an EJB3 Interceptor in Seam

For one of the demos for the NEJUG presentation we integrated the JPetStore (Spring based) and the DVDStore (Seam based) with JBossESB. The idea is that when orders are placed in either store the orders are processed in some ESB based Order Processing Service, using jBPM for the Orchestration. Here I want to show what you need to do to intercept a the order when the user hits the 'confirm' button in the Seam based DVD Store. For this we use an EJB3 interceptor. The beauty of this solution is that no code changes are needed in the DVD Store itself.

1. Modify the ejb-jar.xml
First we need to add some configuration to the ejb-jar.xml, as shown in Figure 1.


Figure 1. Add the interceptor to the ejb-jar.xml


So first we define the interceptor class by referencing
com.jboss.dvd.seam.CheckoutInterceptor
, next we need to specify when this class should be called, which is done by adding the second piece of xml which specifies the bean name for which the interceptor should fire. Here we want it to fire when the
CheckoutAction
is called.

2. Add the interceptor class

The interceptor class itself looks like

package com.jboss.dvd.seam;

import javax.interceptor.AroundInvoke;
import javax.interceptor.InvocationContext;

public class CheckoutInterceptor {

@AroundInvoke
public Object sendOrderToESB(InvocationContext ctx) throws Exception {

System.out.println("*** Entering CheckoutInterceptor");
Object target = ctx.getTarget();
//Just making sure
if (target instanceof CheckoutAction) {
if (ctx.getMethod().getName().equals("submitOrder")) {
System.out
.println("We will send the following completedOrder object to ESB");
Order completedOrder = ((CheckoutAction) target).currentOrder;
Customer customer = ((CheckoutAction) target).customer;
completedOrder.setCustomer(customer);
System.out.println("Completed Order= " + completedOrder);
}
}
try {
return ctx.proceed();
} finally {
System.out.println("*** Exiting CheckoutInterceptor");
}
}
}

Figure 2. The CheckoutInterceptor Code

And that is all there is to it. In the interceptor we check which method is called, and if it is the
submitOrder
method we print out the order. In the demo we added code to serialize the order to XML, and then dropped in onto a gateway Queue, on its way to the ESB.

NEJUG on SOA - The SOA-P Store: Bed, Bath and Beyond (II)

I'm happy to say that the presentation went over well. We got some great questions and in general I think people really got it. Tom Cunningham compiled a list of the questions we got:

Is the registry different than UDDI?
Is there portability across ESB implementations (Mule / Service Mix / JBoss)?
Is there portability across different BPEL providers?
When you are talking about components for ESB, are you talking about adapters?
How gunshy should I be using JBoss ESB (are people using it in production)?
What strategies can I use for portability between ESB providers?
Is there any inherent security in the content based routing? Are there plans on adding something in this area (ACEGI/Spring Security in particular)?
What would you typically see in an actions block?
Would an example of an action be something execuing a rule?
When do you use a J2EE Servlet Filter approach and when would you use ESB?
How would you roll back a transaction?
How do you integrate with RESTful services?
How tightly couple is the rules engine with the ESB?
What monitoring tools exist to see what is going on inside the ESB?
Is there a way inside the ESB to log payload in and out of the ESB?
Is the ESB's state recoverable? Will it maintain state?
How do you track long transactions?
What's the connection between Rules and the ESB?
Will hot deploy consume all current requests before redeploying?
Is load balancing simple round robin?
Does JBPM compete with BPEL?
Is there interactive debugging so that you can step through the JPDL flow?
Are the enterprise design patterns (wiretap, splitter, aggregatore) available inside of a visual designer in JBDS?
Is the JBPM plugin going to be available for NetBeans?
Who is the jbpm-console intended for?
What's the difference between SOA and ESB?
How do you migrate to ESB?

The most humorous question had to be the last one, where someone wanted to know if content based routing could be used as a method of escaping hardware licenses.


Sorry, you had to be there for the answers, but maybe it can be a start for a JBossESB FAQ page.

Monday, March 10, 2008

WhichJar Utility

Where oh where is that class? Setting up your classpath in Java is half the battle. And finding in which jar the class you are looking for lives can be a tedious task. Measured in software years it was ions ago that my friend Toby introduced me to a little shell script he wrote called whichJar. I think I have been using it on a daily basis ever since. It may have changed a little over the years, but not too much, so here it goes:

#!/bin/bash
# nasty script to find a string in the contents of a jar file.
# probably a better way to do this, but then again...

if [ "$1foo" = "foo" ] ; then
echo "$0 usage: `basename $0` string"
echo "where string is the string to look for in the jar's contents"
exit 1
fi

for i in `find . -name \*.jar`
do className=`(jar tvf $i | grep $1)`;
if [ "$className" != "" ]; then
echo -e "$i\t$className";
fi
done

To use it save the above code of to a file called 'whichJar' in your bin directory, and make it executable
chmod a+x whichJar

Then, for example to find the class 'javax.jms.Topic' in any of the jars in the current directory, or any of its subdirectories, simply type
whichJar javax.jms.Topic

Thank you Toby.

NEJUG on SOA - The SOA-P Store: Bed, Bath and Beyond

This Thursday (March 13th) Burr Sutter and I will speak at the NEJUG on SOA "The SOA-P Store: Bed, Bath and Beyond".

This will be a dynamic session focused on the demonstration of the customary capabilities and best practices associated with an Enterprise Service Bus for SOA-focused deployment.

We will get people involved and empowered with real boots-on-the-ground knowledge of how to do SOA and not just pontificate on abstract theory and marketing-speak. The live demonstrations will illustrate how typical Struts+Spring+Hibernate web applications can be liberated as services and enter the world of ESB & SOA.

See you there.

JBoss SOA Platform (SOA-P) Documentation

The SOA-P team incorporates a team of technical writers who take the project specific documentation and turn it into documentation for the SOA Platform, which is the supported 'RHEL' version of JBossESB (where JBossESB would be Fedora). In the true spirit of Open Source, this documentation is available for free, under the support/documentation tab of the Red Hat homepage, or you can go directly to the SOA-P 4.2 docs. I was quite impressed with what they did to some of the docs I wrote! Thanks guys.

Service Orchestration using jBPM

I recently wrote up am entry in the JBossESB blog. This code is now available in the SOA Platform as well as on the trunk of the JBossESB project. For the full documentation in pdf format see the jBPMIntegrationGuide.


Figure 1. Service Integration using jBPM.