Tuesday, December 23, 2014

3 Reasons You Need The New JBoss Travel Agency

(Article guest authored together with Niraj Patel and Shepherd Chengeta, both Inside Solution Architects working in Red Hat EMEA)

This week we are bringing you a new project release for the JBoss BPM Suite Travel Agency project.

It was released in October this year and showed us how to excite the travel industry with a demo project that could demonstrate the following aspects in a bookings process:
  • custom task forms built with forms modeler
  • a sub-process example 
  • two separate service tasks
    • hotel availability service
    • flight availability service
  • rules integration
    • DRL rules
    • decision table
    • diverse guided rules
  • multiple testing scenarios
    Main travel agency process.
The process was a simple bookings process where a user submits a request to travel from one city to another between certain dates. After that the process would kick off two services, one to gather hotel rooms based on availability and another to gather flight information for the given dates. Rules were used to determine the pricing, after which the data gathered was presented in a task form for an agency user to evaluate as complete or needing review by a manager.

The following three features are what makes the JBoss Travel Agency project a must have for your BPM demo arsenal.

Book holiday process with compensation.

1. BPM compensation

The part missing in this story was the actual payment for the approved travel request by the submitting customer.

The team dug into this problem and came up with an extension to the original process that called a new sub-process called Book Holiday.

The original task form presented to the travel agent now was adjusted to ask for credit card information from the customer if the booking is approved. This information will be passed to the new sub-process for billing the fees involved with the flights and hotel rooms being booked by the customer.
Successful path (grey) where no compensation took place.

This new sub-process node calls a process called CompensateService where we see two separate services, one used to facilitate charging the customer for the flights and another for the hotel rooms chosen in the final booking.

Attached to these services are compensation nodes, that are triggered if there is a problem detected at the final gateway, where we then trigger the compensation to take place.

The trick here is that we create a use case where any credit card entered that starts with the numbers 1234... will be considered to belong to a list of fraudulent cards and require a roll back of the booked flights and rooms.
Compensation took place (grey), rolled back credit charges.

This is the compensation path (marked with red nodes) and triggers the compensation paths (marked with pink nodes) before ending the process.

When compensation takes place then the sub-process is ended, returning back to the main process which then also ends.

2. External UI to start process

Compensation was not the only addition to this project, there are a few more new interesting bits to share.

First off, there is an external UI form created to start the Travel Agency process outside of the JBoss BPM Suite generated forms.

This form can be found deployed with the demo project at http://localhost:8080/external-client-ui-form-1.0 if deployed at the default localhost location.

External UI based on RestAPI to start process instances.
The code for this web form can be found under the directory projects/external-client-ui-form-1.0 for your inspection. This project is built by default and deployed into the JBoss BPM Suite server when the demo project is installed using the provided instruction.

3. JSON base process client

The final item is that for the first time we have an incubation project added into the projects directory at projects/instance-generator. This was created by EMEA Senior Solution Architect, Andrea Ubbiali and is a twist on the standard Java class that wrapped the RestAPI to start a series of process instances at once for demo purposes.

See the readme file in this project for how to build by hand and what the details are around the JSON implementation to start new process instances.

Get started today

To get started we provide a quick set of instructions to help you get the Travel Agency demo project up and running with a minimum of fuss:
  1. Add products to installs directory. For example download and add BPMS installer jar into the installs directory.
  2. Run 'init.sh' or 'init.bat' file. 'init.bat' must be run with Administrative privileges.
  3. Start JBoss BPMS Server by running 'standalone.sh' or 'standalone.bat' in the /target/jboss-eap-6.1/bin directory.
  4. Login to http://localhost:8080/business-central
    - login for admin and other roles (u:erics / p:bpmsuite1!)