Adding command-line context parameters
Often, it is required that one or more parameters are passed at runtime to a process to affect its behavior, such as a schedule identifier, or for instance, if the process is common for many different sources, a file identifier. This recipe shows how parameters can be passed into a job via the command line.
Getting ready
Export the job jo_cook_ch11_0030_differentContextVariable
.
How to do it…
- Run the exported job.
- You will see the output contains Hello World.
- Open the launcher.
- Scroll to the end of the line, and add the line
--context_param
name=Dave
. - Run the job again. You will see that the output now contains Hello Dave.
How it works…
Adding the new value to the command line instructs Talend to override any value that has been set within the job context, regardless of the environment.
There's more…
Tip
You can add as many parameters to the command line as there are in your context simply by appending them to the end of the command line...