What is covered?

- Integration of jBPM and Mule ESB
- Scripting (Groovy)

Description

The BPM example illustrates using a business process engine (JBoss jBPM) to orchestrate the loan broker application. Observe how the process flow and decision logic are cleanly defined in a process definition file (which could be created and maintained using a GUI process editor), while the systems integration and messaging is handled by Mule.

Under the Hood

At the heart of the configuration is a Business Process Engine which receives and sends Mule messages. The messages which are received will start or advance a process execution, and the process execution will send messages to Mule endpoints. The jBPM Process performs the following steps:

- The first message to arrive at the BPM process will be a customer request for a loan. This message triggers the BPMS to start a new instance of the "LoanBroker" process. The message payload will be stored into the customerRequest process variable
- The next step is to send the customer's information to the credit agency and get their credit report. The payload that we send to the credit agency comes from the customerRequest we just stored as a process variable
- The request to the credit agency is asynchronous, so we now transition to a wait state until a response from the credit agency is received. Note that if a response is not received within four hours, the process times out and requires manual intervention
- Once a message is received from the credit agency, the next step prepares a loan request based on the two pieces of information we have received thus far (customerRequest and creditProfile)
- The process itself decides which of the three banks, if any, to request a loan from on behalf of this customer
- The final loan quote from the bank is validated and sent back to the customer, and the process ends up in one of two end states: loanApproved or loanDenied, depending on the outcome