Available in...
Open Studio for Big Data
Open Studio for Data Integration
Open Studio for ESB
The example below shows how to share a value between different Jobs via the routine defined earlier.
Procedure
-
Create a Job named childJob1, and add two components
by typing their names on the design workspace or dropping them from the Palette
to the design workspace:
- A tFixedFlowInput to generate an input data flow
- A tJavaRow to receive the data and in which the Job calls the setter method to give a new value to the variable
- Double-click the tFixedFlowInput component to open its Basic settings view.
-
Click the [...] button next to Edit
schema to open the [Schema] dialog box
and define the schema of the input data. In this example, the schema has only
one column name of the string type.
-
In the Mode area, select Use Single Table option, and define the
corresponding value for the message
column in the Values table. In this
example, the value is "Talend".
Note: The tJava component is calling the getter method and assigning the return value to a string variable, then printing the variable value in the console.
- Double-click the tJavaRow component to open its Basic settings view.
-
In the Code area, enter the following code to add the
setter method.
MyRoutine.setValue(input_row.name);
- Create a Job called childJob2 and then create a tJava component in this Job.
- Double-click the tJava component to open its Basic settings view.
-
In the Code area, enter the following code to add the
getter method.
String name=MyRoutine.getValue(); System.out.println(name);