Variables represent values which change throughout the execution of a program.
A global variable is a system variable which can be accessed by any module or function. It retains its value after the function or program using it has completed execution.
Note that globalMap is thread unsafe. Be cautious when using
globalMap.get("key") to create your own global
variables and then retrieve their values in your Jobs, especially after an
Iterate connection with the
parallel execution option enabled.
A context variable is a variable which is defined by the user for a particular context. Depending on the circumstances the Job is being used in, you might want to manage it differently for various execution types, known as contexts (Prod and Test in the example given below). For instance, there might be various testing stages you want to perform and validate before a Job is ready to go live for production use.
A context is characterized by parameters. These parameters are mostly context-sensitive variables which will be added to the list of variables for reuse in the component-specific properties on the Component view through the Ctrl+Space keystrokes.
Talend Studio offers you the possibility to create multiple context data sets. Furthermore you can either create context data sets on a one-shot basis from the context tab of a Job, or you can centralize the context data sets in the Contexts node of the Repository tree view in order to reuse them in different Jobs.
You can define the values of your context variables when creating them, or load your context parameters dynamically, either explicitly using the tContextLoad component or implicitly using the Implicit Context Load feature, when your Jobs are executed.
This section describes how to create contexts and variables and define context parameter values. For an example of loading context parameters dynamically using the tContextLoad component, see the documentation of tContextLoad in the Talend Open Studio for Big Data Components Reference Guide. For an example of loading context parameters dynamically using the Implicit Context Load feature, see Using the Implicit Context Load feature.