Configuring a Job using a tJavaRow component - Cloud - 8.0

Java custom code

Version
Cloud
8.0
Language
English
Product
Talend Big Data
Talend Big Data Platform
Talend Cloud
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for Big Data
Talend Open Studio for Data Integration
Talend Open Studio for Data Quality
Talend Open Studio for ESB
Talend Real-Time Big Data Platform
Module
Talend Studio
Content
Data Governance > Third-party systems > Custom code components (Integration) > Java custom code components
Data Quality and Preparation > Third-party systems > Custom code components (Integration) > Java custom code components
Design and Development > Third-party systems > Custom code components (Integration) > Java custom code components
Last publication date
2023-09-14

This use case shows that it is possible to access the input flow using a dedicated variable and following a specific syntax such as: input_row.name. The source data is processed at runtime by the tJavaRow component.

A common Job using tJavaRow is generally composed of:

  • a tFileInputDelimited component to read data from a text file,
  • a tJavaRow to apply transformation to the data processed,
  • a tLogRow component to print data in the console.

Procedure

  1. In the Palette, slide a tFileInputDelimited , a tJavaRow and a tLogRow component onto the workspace.
  2. Connect tFileInputDelimited to tJavaRow and tJavaRow to tLogRow using a Row > Main link.
  3. Set the Basic settings of the tFileInputDelimited component.
  4. Double-click on tFileInputDelimited to display its Basic settings. The tFileInputDelimited reads the same text file and use the same schema as in the tJava example .
  5. When prompted, click OK to accept the propagation or click afterward on the Sync columns button in the Basic settings view of tJavaRow.
  6. Double-click on tJavaRow to display its Basic settings view and add the following code in the Code area:
    output_row.id = input_row.id;
    output_row.name = (input_row.name).toUpperCase();
    Note: This code converts the column names to upper case.
  7. Execute the Job by pressing F6.

Results