Managing exceptions - 7.3

Talend Connectors for BPM Reference Guide

Version
7.3
Language
English
Product
Talend Data Fabric
Talend Data Services Platform
Talend MDM Platform
Talend Real-Time Big Data Platform
Module
Talend Studio
Content
Design and Development
Last publication date
2023-01-05

About this task

The following example shows how to deal with errors while consuming the Web service.

Procedure

  1. Delete the connection between the Step1 and Step2 tasks, drop the XOR Gateway from the Palette onto the workspace between Step1 and Step2, then connect Step1 to the Gateway and connect the Gateway to Step2.
  2. Select the Gateway output line, and on the General view, enter the condition cRM_Status != null in the Condition field.
  3. On the General view of the Step1 icon, select the Connectors tab then select the CRMService_getCRMInformation connector and click Edit.
  4. Select the Ignore error and continue process reaction in the field named If connector fails..., click Next and then click Finish.
    This allows the process to continue regardless of the response returned by the Web service.
    Now, as the process will continue even in case of exception, you are able to process errors.
  5. Drop a new human task, Step3, from the Palette onto the process design workspace, and assign the Initiator actor to it as we did for Step2.
  6. Add a branch to the Gateway and connect it to Step3, and then connect Step3 to the end event of the process.
  7. Select the alternative Gateway branch. On the General view, enter the condition cRM_Status == null in the Condition field.
  8. Create a new form for Step3, with the check box for the cRM_Status variable cleared. This form will display the error message.
  9. Add the Message element on the form. Select the Data tab of the General view and enter the text: Error occurred while calling the CRM Service! in the Initial value field in the Form perspective.
  10. Next, emulate the exceptional situation: shut down the OSGI container of Talend ESB so that the Web services are no longer available, and run your process.

Results

After trying to consume the unavailable service, you get the following screen.