July 30, 2023

tESBProviderFault – Docs for ESB 7.x

tESBProviderFault

Serves a Talend Job cycle result as a Fault message of the Web service in case of a
request response communication style.

It acts as Fault message of the Web Service response
at the end of a Talend Job cycle.

tESBProviderFault Standard properties

These properties are used to configure tESBProviderFault running in the Standard Job framework.

The Standard
tESBProviderFault component belongs to the ESB family.

This component is relevant only when used with one of the
Talend
solutions with ESB, as it should be used with the Service Repository node and the Data Service creation related wizard(s).

Basic settings

Schema and Edit schema

A schema is a row description. It defines the number of fields
(columns) to be processed and passed on to the next component. When you create a Spark
Job, avoid the reserved word line when naming the
fields.

Click Edit
schema
to make changes to the schema. If the current schema is of the Repository type, three options are available:

  • View schema: choose this
    option to view the schema only.

  • Change to built-in property:
    choose this option to change the schema to Built-in for local changes.

  • Update repository connection:
    choose this option to change the schema stored in the repository and decide whether
    to propagate the changes to all the Jobs upon completion. If you just want to
    propagate the changes to the current Job, you can select No upon completion and choose this schema metadata
    again in the Repository Content
    window.

Click Sync columns to retrieve
the schema from the previous component connected in the Job.

 

Built-in: The schema is created
and stored locally for this component only. Related topic: see

Talend Studio User
Guide
.

 

Repository: The schema already
exists and is stored in the Repository, hence can be reused. Related
topic: see
Talend Studio User
Guide
.

EBS service settings

Fault title: Value of the
faultString column in the
Fault message.

Note:

The Row > Fault flow of tESBConsumer has a pre-defined schema whose
column, faultString, is
filled up with the content of the field Fault title of tESBProviderFault.

Advanced settings

tStatCatcher Statistics

Select this check box to gather the Job processing metadata at a
Job level as well as at each component level.

Global Variables

Global Variables 

NB_LINE: the number of rows processed. This is an After
variable and it returns an integer.

ERROR_MESSAGE: the error message generated by the
component when an error occurs. This is an After variable and it returns a string. This
variable functions only if the Die on error check box is
cleared, if the component has this check box.

A Flow variable functions during the execution of a component while an After variable
functions after the execution of the component.

To fill up a field or expression with a variable, press Ctrl +
Space
to access the variable list and choose the variable to use from it.

For further information about variables, see
Talend Studio

User Guide.

Usage

Usage rule

This component should only be used with the tESBProviderRequest component.

Limitation

A JDK is required for this component to operate.

Requesting airport names based on country codes

This scenario applies only to Talend Open Studio for ESB, Talend Data Services Platform and Talend Data Fabric.

This scenario involves two Jobs, one as the data service provider and the
other as data service consumer. The former listens to the requests from the consumer via
tESBProviderRequest, matches the country code
wrapped in the request against a MySQL database table that has the country code/airport
pairs via tMap, and finally returns the correct
airport name via tESBProviderResponse or if no
matches are found, the error message via tESBProviderFault. The Consumer sends requests to the Provider and
receives the airport information or error reminders via tESBConsumer.

Building the data service provider to publish a service

The data service airport has already been
defined under the Services node of the Repository tree view. Its schema has three major elements
as shown below:

tESBProviderFault_1.png

For how to define a service in the Studio, see
Talend Studio User
Guide
.

Assigning a Job to the defined service

  1. Right-click getAirportInformationByISOCountryCode under the Web
    service airport and from the
    contextual menu, select Assign Job.
  2. In the Operation Choice window,
    select Create a new Job and Assign it to this
    Service Operation
    .

    tESBProviderFault_2.png

  3. Click Next to open the Job
    description window. The Job name airportSoap_getAirportInformationByISOCountryCode is
    automatically filled in.

    tESBProviderFault_3.png

  4. Click Finish to create the Job and
    open it in the workspace. Three components are already available.

    tESBProviderFault_4.png

Adding components to arrange the data flow

  1. Drop tXMLMap and tMysqlInput from the Palette to the workspace.
  2. Link tESBProviderRequest to tXMLMap using a Row > Main
    connection.
  3. Link tMysqlInput to tXMLMap using a Row > Main
    connection.
  4. Link tXMLMap to tESBProviderResponse using a Row > *New
    Output*(Main)
    connection.

    In the new Output name pop-up window,
    enter the output table name, airport_response.
    Click OK in the pop-up window that
    asks whether to get the schema of the target component.
  5. Link tXMLMap to tESBProviderFault using a Row > *New
    Output*(Main)
    connection.

    In the new Output name pop-up window,
    enter the output table name, fault_message.
    Click OK in the pop-up window that
    asks whether to get the schema of the target component.
    tESBProviderFault_5.png

Configuring how requests are processed

  1. Double-click tMysqlInput to display
    its Basic settings view.

    tESBProviderFault_6.png

  2. Fill up the basic settings for the Mysql connection and database
    table.

    Click the […] button to open the
    schema editor.
    tESBProviderFault_7.png

  3. Click the [+] button to add two
    columns, id and name, with the type of string.

    Click OK to close the editor.
    Click Guess Query to retrieve the SQL
    query.
  4. Double-click tXMLMap to open its
    mapper.

    tESBProviderFault_8.png

  5. In the main : row1 table of the input
    flow side (left), right-click the column name payload and from the contextual menu, select Import from Repository. Then the Metadata wizard is opened.

    tESBProviderFault_9.png

    Select the schema of the request message and click OK to validate this selection. In this
    example, the schema is getAirportInformationByISOCountryCode.
  6. Do the same to import the hierarchical schemas for the response/fault
    messages (right). In this example, these schemas are getAirportInformationByISOCountryCodeResponse and
    getAirportInformationByISOCountryCodeFault
    respectively.
  7. Then to create the join to the lookup data, drop the CountryAbbrviation node from the main flow
    onto the id column of the lookup
    flow.
  8. On the lookup flow table, click the wrench icon on the upper right
    corner to open the setting panel.

    Set Lookup Model as Reload at each row, Match Model as All
    matches
    and Join Model
    as Inner join.
  9. On the airport_response output flow
    table, click the wrench icon on the upper right corner to open the
    setting panel.

    Set the All in one option as
    true. This ensures that only one
    response is returned for each request if multiple airport matches are
    found in the database.
  10. On the fault_message output flow
    table, click the wrench icon on the upper right corner to open the
    setting panel.

    Set the Catch Lookup Inner Join
    Reject
    option as true to
    monitor the mismatches between the country code in the request and the
    records in the database table. Once such a situation occurs, a fault
    message will be generated by tESBConsumer and outputted via its Row > Fault
    flow.
    Note:

    The Row > Fault flow of tESBConsumer has a predefined schema in which the
    faultString column is filled
    with the content of the field Fault
    title
    of tESBProviderFault.

  11. Drop the name column in the lookup
    flow onto the Expression area next to
    the tns:getAirportInformationByISOCountryCodeResult node in
    the airport_response output flow.

    Drop the tns:CountryAbbreviation
    node in the main flow onto the Expression area next to the tns:getAirportInformationByISOCountryCodeFaultString
    node in the fault_message output
    flow. This way, the incorrect country code in the request will be shown
    in the faultDetail column of the
    Row > Fault flow of tESBConsumer.
    Click OK to close the editor and
    validate this configuration.
  12. Double-click tESBProviderFault to
    display its Basic settings view:

    tESBProviderFault_10.png

  13. In the field Fault title, enter the
    context variable context.fault_message.

    For how to define context variables, see
    Talend Studio User Guide
    .

Publishing the service to listen to requests

  1. Press Ctrl +S to save the Job.
  2. Press F6 to run this Job.

    tESBProviderFault_11.png

The data service is published and will listen to all the requests until you
click the Kill button to stop it as by default,
the Keep listening option of tESBProviderRequest is selected automatically.

Now is the time to configure the consumer Job that interacts with the data
service.

Building the data service consumer to request the service

Built upon tESBConsumer, the consumer Job sends
two requests that contain the country codes to the Web service for the relevant
airport names. If wrong country code is wrapped in the request, the error message
will be returned. The country codes and the MySQL database records are as
follows:

tESBProviderFault_12.png

Dropping and linking the components

  1. Drop a tFileInputDelimited, a
    tXMLMap, a tESBConsumer and two tLogRow from the Palette to the workspace.
  2. Rename one tLogRow as response and the other as fault_message.
  3. Link tFileInputDelimited to tXMLMap using a Row > Main
    connection.
  4. Link tXMLMap to tESBConsumer using a Row > *New
    Output*(Main)
    connection.

    In the new Output name pop-up window,
    enter the output table name, for example request.
    Click OK in the pop-up window that
    asks whether to get the schema of the target component.
  5. Link tESBConsumer to response using the Row > Response
    connection.
  6. Link tESBConsumer to fault_message using the Row > Fault
    connection.

    tESBProviderFault_13.png

Configuring the components

  1. Double-click tFileInputDelimited to
    open its Basic settings view.

    tESBProviderFault_14.png

  2. In the File name/stream field, enter
    the context variable for the file that has the country codes, context.filepath.
  3. Click the […] button to open the
    schema editor.

    tESBProviderFault_15.png

  4. Click the [+] button to add a column,
    country_code, for example, with
    the type of string.

    Click OK to close the editor.
  5. Double-click tXMLMap to open its Map
    editor.

    tESBProviderFault_16.png

  6. In the request table of the output
    flow side, right-click the column name payload and from the contextual menu, select Import from Repository. Then the Metadata wizard is opened.

    tESBProviderFault_9.png

    Select the schema of the request message and click OK to validate this selection. In this
    example, the schema is getAirportInformationByISOCountryCode.
  7. Drop the country_code column in the
    main flow onto the Expression area next
    to the tns:CountryAbbreviation node
    in the request output flow.

    Click OK to close the editor and
    validate this configuration.
  8. Double-click tESBConsumer to open its
    service configuration wizard:

    tESBProviderFault_18.png

  9. Click the Browse… button to select
    the desired WSDL file. The Port name
    and Operation are automatically filled
    up once the WSDL file is selected.

    Click OK to close the wizard.
  10. Double-click response to open its
    Basic settings view:

    tESBProviderFault_19.png

  11. Select Vertical (each row is a key/value
    list)
    and then Print
    label
    for a better view of the results.

    Do the same to the other tLogRow,
    fault_message.

Executing the Job

  1. Press Ctrl +S to save the Job.
  2. Press F6 to run this Job.

    tESBProviderFault_20.png

    tESBProviderFault_21.png

    As shown above, two messages are returned, one giving the airport name
    that matches the country code CN and
    the other giving the error details caused by the country code CC.

Document get from Talend https://help.talend.com
Thank you for watching.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x