Cars Online Part 5 - Order To Invoice
By The Old Toxophilist on Feb 25, 2010
This is the Third entry in this trail that is GlassFish ESB (Open
ESB) and presents the final stage of the Cars Online ordering process
and discusses the functionality available within the Order to Invoice
process. It will take you through the functionality provided and
explain how this is implemented to provide a real-time response to a
long running process. Now because the intention is to use this in a
demonstration scenario the processes are all designed to run in minutes
rather than in days.
We will also look at how this application is integrated with the Back
BPEL Monitor to provide the user / customer with a
Business Skinned Order tracking functionality based on the in-build
Open ESB / GlassFish ESB Monitoring tables and functionality.
Order To Invoice business Process, bsCreateOrder, provides the final
step in the Cars Online process and takes all the Customers data and
passes it through a number for Business Action (Sub Processes) to build
AJAX Servlet call from the "Place Order" button that resides in the
button bar at the base of the Quote Screen.
Once the Business Process has been initiated it will follow the
Steps define below but does not wait until completion before it
returns. Thus we can receive a response that the order has been
validated and sent but the process will continue to run Asynchronously.
Alternatively we could have simply used JMS to provide the Asynchronous
processing but this would not have given me the ability to seamlessly
integrate with , and hence leverage, the Open ESB / GlassFish ESB
- Generate a Unique Order Id.
- Persist the Order to a database.
- Reply - This does not terminate the process but simply allows it to continue running Asynchronously.
- Validate The Order.
- Order Confirmation - Send an Email to the customer.
- Set-up Finance.
- Build the Car.
- Deliver to the Dealer.
- Ready for Pickup - Emails the Customer informing them that they can pick up their car.
- Invoice - Send out Invoice by Email.
It can be seen from the BPEL process that this top level Business
Process does not contain any Technical functionality but rather simply
calls a series of Business Services that will execute the appropriate
functionality. This provides a number of advantages because the
Business Analyst can design this process and the Developer can build
the Services. In addition because this will be a long running
transaction it will be passivated to the database rather than remaining
in memory whilst waiting for the appropriate response. The net result
of this is a reduction in the memory requirement of the process.
The persist order Business Service will simple take the order
details and write them to an appropriate database. At the moment it
will take write a limited set of information because that is all that
is needed for the demonstration.
If necessary we could link with the persistence
database to retrieve the full details.
The Validate Order process simply checks that all the required
fields have been completed and then returns.
The Order Confirmation process will take the Order information, that has been validated, and build the Order Confirmation email that will then be send to the Customer and the Accounts email. The generated email will be displayed in HTML and contain a link that will allow the user to link to the Cars Online Order Tracking screen. When this is selected the Customer Order information will be displayed along with a Business Skinned SVG Representation of the Order To Invoice Business Process.
Although the current email is simple in its layout this provides
enough information for the user and does not burden the email client.
We could, if required, enhance this with a similar L&F to the web
The Finance Order process takes the Customer order information and
arranges the previously agreed finance terms. If this is a Cash payment
the it does not do anything because we already have the customers cash.
The Build Car process simulates the ordering of components and
building of the car. This is currently done using a number of wait
processes because we can not actually build the vehicle.
Deliver to Dealer
The Delivery to the Dealer process would activate a human workflow
that receives the vehicle and takes it through the various dealer
checks and valeting.
Ready For Pick-up
Following the Delivery the Ready For Pick-up process will simple
build a new email message that can be sent to the Customer informing
them that their car is now ready for them.
The Invoice process is the final Business Service to be executed and
will raise an invoice in the approriate end systems and then email it