Sunday, June 16, 2013

Developing a transactional Advanced Integration Service with IBM Business Process Manager: Defining the business process

Define the BPMN process in IBM Process Designer
In Part 2, we'll define a process application called KBPM with a with a KBPM – Process1 business process definition (BPD). The complete process application, KBPM.twx, is provided for download in Part 1 of this series.
The high-level part of the solution proposed in this series is a business process modeled in business process modeling notation (BPMN) in the IBM BPM Process Designer. Figure 1 shows the KBPM – Process1 process as mapped in Process Designer.

Figure 1. The BPMN business process in Process Designer
The BPMN business process in                     Process Designer 
The activities in the KBPM – Process1 process are as follows:
  • Input Data activity: Implemented as a user task with the human service KBPM - Input Data HS
  • Make Transaction activity: Implemented as a system task with the Advanced Integration Service (AIS) TxAIS
  • Error intermediate event My Error Event, attached to the Make Transaction activity: Catches the Make Transaction AIS errors, and can drive the execution flow to the Show Error activity (with a related human service and presentation Coach)
  • Show Results activity: Implemented as a user task with the KBPM – Show Results HS human service
  • Show Error activity: Implemented as a user task with the Show Error Human Service human service
  • Another Transaction gateway: Enables the loop to execute another transaction (based on an ExitCondition flag that the user can set in the Show Result or Show Error activities)
This article describes the process.
The process variables
The KBPM - Process1 BPD defines a set of variables to manage the configuration of the transaction and the transfer of values from the different activities involved in the process (which are implemented by three human services and an Advanced Integration Service). Figure 2 shows the variables defined at the process level.

Figure 2. The business process variables
The business process                     variables 
Table 1 shows the default values for the business process variables provided in the downloadable example.

Table 1. Default values for the process variables
VariableDefault valueNote
Connection1Chargejdbc/bank1sqlserverjdbc connection name to the Bank1 database
Table1Chargedbo.AccountsTable of the account to charge (on Bank1)
Account1ChargeKarlName of the account to charge (on Bank1)
Amount10Amount to transfer
Connection2Creditjdbc/bank2db2JDBC connection name to the Bank2 database
Table2CreditADMINISTRATOR.AccountsTable of the account to credit (on Bank2)
Account2CreditDonaldName of the account to credit (on Bank2)
ExitConditionTo manage the option to make another new transaction
OutputMessagePositive outcome message string
ErrorMessageError message string


The KBPM – Input Data HS human service
The Input Data activity is implemented with the KBPM – Input Data HS human service. Figure 3 shows the I/O data mapping.

Figure 3. Data mapping for KBPM – Input Data HS human service
Data mapping for KBPM – Input                     Data HS human service 
Figure 4 shows the diagram of this human service. There is only one Coach (KBPM – Input Data HS – Coach1), as shown.

Figure 4. Diagram of KBPM – Input Data HS human service
Diagram of KBPM – Input Data                     HS human service 
Figure 5 shows the variables defined and used for this human service.

Figure 5. Variables for KBPM – Input Data HS human service
Variables for KBPM – Input Data                     HS human service 
Figure 6 illustrates the layout of the Coach.

Figure 6. The Coach in KBPM – Input Data HS human service
The Coach in KBPM – Input Data                     HS human service 
The only purpose of this human service, and its related Coach, is to harvest the required values for the parameters necessary to drive the transaction. The values of these parameters will be passed to the transactional TxAIS AIS, as described in the next section.
Define the TxAIS Advanced Integration Service to support the Make Transaction activity
This TxAIS component is core part of our solution. From the point of view of the Process Designer, it's only another service to invoke, and is described by its interface. Figure 7 shows the AIS configuration screen in Process Designer.

Figure 7. The Advanced Integration Service in Process Designer
The Advanced                     Integration Service in Process Designer 
As you can see, the parameters provided to the AIS correspond well with the process variables described earlier, and define the required configuration for the transaction to be performed, including source connection, table and account, amount, and destination connection, table and account.
The values for these parameters are configured in the Data Mapping properties of the Make Transaction activity, as shown in Figure 8.

Figure 8. Data mapping for the transactional activity
Data mapping for the                     transactional activity 
In case of error, the error intermediate event attached to the Make Transaction activity catches the exception. It's configured to receive the error message contained on the ErrorMessage parameter of the AIS, as shown in Figure 9.

Figure 9. The implementation of the error event
The implementation of the                     error event 
As you can see, the error string is also copied in the process variable ErrorMessage.
The KBPM – Show Results HS human service
This human service shows the positive outcome of the transaction executed by the Make Transaction activity. Figure 10 shows the data mapping for the Show Results activity implemented by this human service.

Figure 10. Data mapping for KBPM – Show Results HS human service
Data mapping for KBPM – Show                     Results HS human service 
Figure 11 shows the variables for the KBPM - Show Results HS human service.

Figure 11. Variables for KBPM – Show Results HS human service
Variables for KBPM – Show                     Results HS human service 
Figure 12 shows the flow of the human service.

Figure 12. Diagram of KBPM – Show Results HS human service
Diagram of KBPM –                     Show Results HS human service 
There is only one Coach in this human service, called KBPM – Show Results HS – Coach1, as shown in Figure 13.

Figure 13. The coach in KBPM – Show Results HS human service
The coach in KBPM – Show                     Results HS human service 
The Output Text controls are bound with the input variables, and the two buttons enable the user to terminate the process or to restart with a new transaction with new parameters values.
The two server scripts EvaluateExitConditionToTrue and EvaluateExitConditionToFalse are designed only to set theExitCondition boolean value to true or to false respectively.
The Show Error Human Service
This human service shows the error condition eventually returned by the Make Transaction activity (the activity that uses the transactional AIS implementation).
Figure 14 shows the data mapping for the Show Error activity implemented by the Show Error Human Service.

Figure 14. Data mapping for Show Error activity
Data mapping for Show Error                     activity 
Figure 15 shows the variables for the Show Error Human Service.

Figure 15. Variables for Show Error Human Service
Variables for Show Error Human                     Service 
Figure 16 shows the diagram for Show Error Human Service.

Figure 16. The Show Error Human Service diagram
The Show Error Human Service                     diagram 
In this human service there is a Show Error Coach, shown in Figure 17.

Figure 17. The Coach in Show Error Human Service
The Coach in Show Error Human                     Service 
The txtErrorMessage Output Text control is bound to the ErrorMessage variable, and passed as input to the Show Error Human Services.
Conclusion
In Part 2 of this series, we covered how to define and implement the business process in IBM Business Process Manager Advanced, using the Process Designed tool and the BPMN notation. You've learned how to create the Business Process Definition, the human services, the coaches, and how to define the process variables to support the configuration and the management of the outcomes from the transactional service. In Part 3, you'll learn how to implement the transactional AIS in Integration Designer, based on an SCA BPEL microflow with a couple of Java-based SCA components.

No comments :

Post a Comment