Read the original article at The Crooked Stick

This is the Third entry in this trail that is GlassFish ESB (OpenESB) and presents the final stage of the Cars Online ordering processand discusses the functionality available within the Order to Invoiceprocess. It will take you through the functionality provided andexplain how this is implemented to provide a real-time response to along running process. Now because the intention is to use this in ademonstration scenario the processes are all designed to run in minutesrather than in days.

We will also look at how this application is integrated with the BackInBlack BPEL Monitor to provide the user / customer with aBusiness Skinned Order tracking functionality based on the in-buildOpen ESB / GlassFish ESB Monitoring tables and functionality.


TheOrder To Invoice business Process, bsCreateOrder, provides the finalstep in the Cars Online process and takes all the Customers data andpasses it through a number for Business Action (Sub Processes) to buildand deliver the Car. The BPEL Process is trigger via JavaScript and andAJAX Servlet call from the "Place Order" button that resides in thebutton bar at the base of the Quote Screen.

Once the Business Process has been initiated it will follow theSteps define below but does not wait until completion before itreturns. Thus we can receive a response that the order has beenvalidated and sent but the process will continue to run Asynchronously.Alternatively we could have simply used JMS to provide the Asynchronousprocessing but this would not have given me the ability to seamlesslyintegrate with , and hence leverage, the Open ESB / GlassFish ESBMonitoring functionality.

Thesteps required to process an Order to completion are:

  1. Generate a Unique Order Id.
  2. Persist the Order to a database.
  3. Reply - This does not terminate the process but simply allows itto continue running Asynchronously.
  4. Validate The Order.
  5. Order Confirmation - Send an Email to the customer.
  6. Set-up Finance.
  7. Build the Car.
  8. Deliver to the Dealer.
  9. Ready for Pickup - Emails the Customer informing them that theycan pick up their car.
  10. Invoice - Send out Invoice by Email.
It can be seen from the BPEL process that this top level BusinessProcess does not contain any Technical functionality but rather simplycalls a series of Business Services that will execute the appropriatefunctionality. This provides a number of advantages because theBusiness Analyst can design this process and the Developer can buildthe Services. In addition because this will be a long runningtransaction it will be passivated to the database rather than remainingin memory whilst waiting for the appropriate response. The net resultof this is a reduction in the memory requirement of the process.

Process Steps

Persist Order

The persist order Business Service will simple take the orderdetails and write them to an appropriate database. At the moment itwill take write a limited set of information because that is all thatis needed for the demonstration.

If necessary we could link with the persistencedatabase to retrieve the full details.

Validate Order

The Validate Order process simply checks that all the requiredfields have been completed and then returns.

Order Confirmation

The Order Confirmation process will take the Order information, thathas been validated, and build the Order Confirmation email that willthen be send to the Customer and the Accounts email. The generatedemail will be displayed in HTML and contain a link that will allow theuser to link to the Cars Online Order Tracking screen. When this isselected the Customer Order information will be displayed along with aBusiness Skinned SVG Representation of the Order To Invoice BusinessProcess.

Although the current email is simple in its layout this providesenough information for the user and does not burden the email client.We could, if required, enhance this with a similar L&F to the webapplication.

Finance Order

The Finance Order process takes the Customer order information andarranges the previously agreed finance terms. If this is a Cash paymentthe it does not do anything because we already have the customers cash.

Build Car

The Build Car process simulates the ordering of components andbuilding of the car. This is currently done using a number of waitprocesses because we can not actually build the vehicle.

Deliver to Dealer

The Delivery to the Dealer process would activate a human workflowthat receives the vehicle and takes it through the various dealerchecks and valeting.

Ready For Pick-up

Following the Delivery the Ready For Pick-up process will simplebuild a new email message that can be sent to the Customer informingthem that their car is now ready for them.


The Invoice process is the final Business Service to be executed andwill raise an invoice in the approriate end systems and then email itthe customer.