Configuring a Job using a tJavaFlex component - Cloud - 8.0

Java custom code

Version
Cloud
8.0
Language
日本語
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
ジョブデザインと開発 > サードパーティーシステム > カスタムコードコンポーネント > Javaカスタムコードコンポーネント
データガバナンス > サードパーティーシステム > カスタムコードコンポーネント > Javaカスタムコードコンポーネント
データクオリティとプレパレーション > サードパーティーシステム > カスタムコードコンポーネント > Javaカスタムコードコンポーネント
Last publication date
2023-09-14

The tJavaFlex component is used to inject code at the start/end of a Job and to transform data transformations for each row.

A common Job using tJavaFlex is generally composed of:

  • a tFileInputDelimited component to read data from a text file,
  • a tJavaFlex to inject specific code at various moment of the Job processing (start, main or end parts),
  • a tLogRow component to print data in the console and processing information based on what the code injection says in the start and/or end part of tJavaFlex.

Procedure

  1. In the Palette, slide a tFileInputDelimited , a tJavaFlex 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 and tJavaRow example .
  5. When prompted, click OK to accept the propagation or click afterward on the Sync columns button in the tJavaRow Basic settings view.
  6. Double-click on tJavaRow to display its Basic settings view. Add the following code in the Start code area:
    System.out.println("******The subJob begins to work!******");
    int nb_line=0
  7. Add the following code in the Main code area:
    row2.name=(row1.name).toUpperCase();
    nb_line++;
  8. Add the following code in the End code area:
    System.out.println("The total number of processed data is: "+nb_line);
    System.out.println("******The subJob finishes!******");
    Note: This code converts the column names to upper case.
  9. Execute the Job by pressing F6.

Results