Friday, October 17, 2008

Who Needs Workflow?

Surprisingly enough, maybe you?

Workflow is one of those terms with which you have probably played buzzword bingo. If not the over-generalized category name, perhaps you have a bingo card covered in the acronyms that proliferate in this space, like the BP brothers -- BPM, BPEL, BPMN and BPDM. And, don't forget their webified cousins, WS-BPEL, WS-CDL and WSFL. Uh, uhh, BINGO!

For as many players in this space, it is surprising how few developers have ever laid their hands upon a workflow engine. Many companies tend to shy away from these offerings because they are part of a larger SOA initiative which takes a great amount of time and resources to roll out. There are also very few quality open source players in this area.

I've been meaning to dig in to see what makes a workflow engine tick, and a recent project afforded me the chance. It has a small workflow with twenty odd steps that has a few manual stages, credit card processing and email events. I could of written the process manually, but I wouldn't of learned anything new.

So now I can share with you some of my stumbles along the way and how workflow can function in a real world application. The first step is to choose your foil.

Keep in mind, I am not very knowledgeable of the players in the workflow arena. As I started this journey, I gained hands-on experience with only a few. Also note that I am developing personal software and price was a factor. :)

The Players

There are a boatload of players in the workflow market, and many have come and gone over the years. When I look at some of the players in this field, I sometimes get the feeling that programmers created a workflow for their in-house project and then open sourced it on the world. For many engines, there are probably only one or two applications that use it.

There are dozens of sites that contain a long list of commercial and open source workflow engines written in Java. Notably, OpenWFE was one of the more popular Java workflow engines and is now being developed as a Ruby application.

Open Source Workflow Engines Written in Java

www.manageability.org

Commercial Workflow BPM Vendors - Part I

Commercial Workflow/BPM Vendors - Part II

www.waria.com

While reviewing some of the different open source products, it dawned on me the world of the big standards belongs to the big commercial vendors as evidenced by the following chart from Gartner. That's fine with me because my needs are much simpler.

Gartner Magic Quadrant - BPMS

If anyone knows, I would be interested to see if any of these products are free or open source and if they are embeddable. Most that I inspected were commercial and standalone or integrated into an SOA or J2EE application server.

My Needs

I am modeling an order workflow, but I will probably create additional processes once I have handled my first priority. I need a workflow engine that I can embed in my application. I do not wish to run the workflow engine as a standalone server who's sole purpose in life is to process workflow lifecycles. These products have their place when the scale of an enterprise demands such needs, however my requirements are much more modest. It may be important for the engine I pick to have this capability or at least be able to cluster if scale becomes important.

I do want to be able to kick off tasks (execution processes in workflow-speak) and have the workflow engine shepherd the task along its path. At certain points along the workflow process I need the engine to delegate control to custom tasks that I have written in Java or Groovy. These tasks are very short and focus on a small part of the overall process like authorizing a credit card or checking the availability of a product.

I know there will be some situations when the workflow will have to pause for human intervention as might happen if a credit card was authorized successfully, but failed the capture stage. Or perhaps a human will manually review orders over a certain dollar amount to ensure the validity of the order. When these cases occur, the workflow is essentially paused while the user reacts to each situation on a case by case matter. This means that I will need to somehow track when these issues arise and bring them to the attention of the appropriate user. Once the employee handles the issue, control will return to the workflow engine to proceed based on the outcome of the manual intervention.

I also want an audit log that helps me visualize the path taken by the customer's order. This is helpful when dealing with customer service problems. I usually use the Spring Framework, and although I didn't need Spring to wrapper the engine for me, it would be nice if my java extensions to the workflow process could be configured within Spring.

My needs are simple. I don't need a graphical tool for manipulating the workflow, but neither will I turn one down if it is offered. I don't need identity support which allows the workflow engine to route tasks to users based on their roles in the system. I have one employee and that person is me.

Also note that I don't need any of the acronyms mentioned at the beginning of this post. I need a workflow engine, and I don't particularly care if is supports BPEL, BPMN or OSSAD. I don't have anything against standards, but they are still in a state of flux after nearly 10 years of formulation. Most workflow engines have a low level model similar to a finite state machine, and the business language du jour is just a layer above this. Many platforms that are designed this way will support a variety of business process modeling languages existing today. BPEL seems to be the current de facto standard in use amongst most of the market leaders right now.

The Search

Like most Java developers, I start my search for a library by searching the web for current articles and who the players are in the open source area. Unlike technologies like ORM where one or two libraries stand out from the rest, the open source Java workflow market is huge, which makes research difficult. Contrast this with the .NET market where there is one player. I wonder who?

The closest thing I found to an objective comparison of workflow engine's capabilities was this report on the Workflow Patterns website. The report confirmed that no one dominates this space, but it at least highlights three decent players who are JBoss jBPM, OpenWFE, and Enhydra Shark. I have not yet heard of Shark, but I have great respect for Enhydra from my very early days in Java when they competed with JBoss in the application server space.

These recent articles on The Server Side featured a new Finite State Machine from the Wazee Group called Physhun. It is completely configured using Spring, so it seemed like a potential fit.

Enhydra Shark had no documentation available on its website. The latest news said that version 2 was recently released, but checking in the logs it shows that happened in May 2007. As mentioned earlier, OpenWFE is now OpenWFEru where the "ru" stands for Ruby. I didn't look at it, but I would bet that the process definition language used can benefit from Ruby's DSL-like language capabilities. Physhun is very nice, and documented sparsely, but includes several good examples that are easy to follow along to. I find Physhun to work really well for what it is intended; Finite State Machines. It doesn't have the layers to handle tasks requiring human intervention. It seems like a decent base to build these capabilities on top of if you were so inclined. In the end, a FSM is not the same thing as a workflow engine.

JBoss jBPM

Like most things developed by JBoss, their workflow engine is meant to complement their application server, but can be used independently as well. jBPM version 3 has been out for three years and based on the forum posts, seems to have a decent user base. Support by the actual developers has waned over the past two years for whatever reasons, so this is a bit of a concern. Ronald van Kuijk is a member of the community and seems to be a one man army when it comes to helping people with jBPM. jBPM 4 is being developed, so perhaps the product will continue to be improved, and maybe that's what the core developers are spending their time on. jBPM has some relationship to the commercial JBoss product offering by Red Hat, so I would assume it is an important component to their product suite and is not going away anytime soon.

To help with my needs, jBPM provides me with a single jar library that is easily embeddable in my application. Although jBPM supports the BPEL standard, my needs are sufficiently handled by jPDL; an XML-based graph oriented programming model. (That's JBoss-speak for an XML configuration.)

You may read somewhere that jBPM does not require a database, however in order to do anything useful such as supporting tasks and being able to recover its state across server restarts, a database is required. Somewhat unfortunately, it uses Hibernate to persist its internal model. Not a deal breaker, but those people who weren't already using Hibernate will be now, and those using it already may have to take steps to get two different Hibernate session factories to play nice in the same application scope. This could involve JTA transaction management if you cannot share session factories. It would be nice if this could be extracted out of the engine in the future with a Hibernate implementation being the default.

On the plus side, jBPM is a workflow engine supported by the spring modules project. This project provides an object factory integration such that jBPM actions can be Spring Beans. Also, the creation of a Hibernate SessionFactory and sharing it with jBPM is made substantially easier.

What's Next

In the next installment, we will get into the code and some more concepts behind the workflow engine.

1 comment:

  1. Hi Jim,

    Very good post. Especially your summary on jBPM is right on the spot. Kudo's to Ronald for managing the free forums. Apart from providing support and maintenance for jBPM 3, my team is indeed building jBPM 4 which fixes all remaning inconveniences and grow to become a full BPM product.

    regards, tom.

    ReplyDelete