Scenario 2: Log & kill a Job - 6.1

Talend Open Studio for Big Data Components Reference Guide

Talend Open Studio for Big Data
Data Governance
Data Quality and Preparation
Design and Development
Talend Studio

This scenario uses a tLogCatcher and a tDie component. A tRowGenerator is connected to a tFileOutputDelimited using a Row link. On error, the tDie triggers the catcher subjob which displays the log data content on the Run console.

  • Drop all required components from various folders of the Palette to the design workspace: tRowGenerator, tFileOutputDelimited, tDie, tLogCatcher, tLogRow.

  • On the tRowGenerator Component view, define the setting of the input entries to be handled.

  • Edit the schema and define the following columns as random input examples: id, name, quantity, flag and creation.

  • Set the Number of rows onto 0. This will constitute the error which the Die operation is based on.

  • On the Values table, define the functions to feed the input flow.

  • Define the tFileOutputDelimited to hold the possible output data. The row connection from the tRowGenerator feeds automatically the output schema. The separator is a simple semi-colon.

  • Connect this output component to the tDie using a Trigger > If connection. Double-click on the newly created connection to define the if:

    ((Integer)globalMap.get("tRowGenerator_1_NB_LINE")) <=0

  • Then double-click to select and define the Basic settings of the tDie component.

  • Enter your Die message to be transmitted to the tLogCatcher before the actual kill-job operation happens.

  • Next to the Job but not physically connected to it, drop a tLogCatcher from the Palette to the design workspace and connect it to a tLogRow component.

  • Define the tLogCatcher Basic settings. Make sure the tDie box is selected in order to add the Die message to the Log information transmitted to the final component.

  • Press F6 to run the Job and notice that the log contains a black message and a red one.

  • The black log data come from the tDie and are transmitted by the tLogCatcher. In addition the normal Java Exception message in red displays as a Job abnormally died.