Passing Context Parameters from Command Line to Talend Job

Posted on by By Nikhilesh, in Business Intelligence, ETL, Talend | 0

Passing Context Parameters from Command Line to Talend Job

Some times we have to pass context parameter value from commandline while executing talend job (.bat file or .sh file) which gets generated when we export job. We can make use of “–context_param” command in commandline  to pass the context parameter values while executing talend job from command line.

Here is a simple job for passing the context parameters from commandline.

Make data easy with Helical Insight.
Helical Insight is world’s best open source business intelligence tool.

Click Here to Free Download

Place tjava component on working area, and under the component tab write a code to print the context parameter values as shown in below screen shot:

bg1

 

Declare the context Parameters and assign a defualt values under the Contexts tab for this job.

Here I have declared two context parameters as param1 and param2 and assigned default values as shown in the below screen shot:

bg2

Now if we execute this job from studio it will display these default values on the console as shown in the below screen shot.

bg

If we execute this job from command line without providing the context parameters it will display the default values as follows:

bg3

Now execute the job by providing context variables in command line prompt. It will display these values as the output instead of default values as shown in the below output.

Make data easy with Helical Insight.
Helical Insight is world’s best open source business intelligence tool.

Lets Start Free Trail

Here I passed ‘a1’ and ‘a2’ as the context parameter values for param1 and param2 context variables respectively.

bg4

Thanks and Regards,

Lalitha

logo

Best Open Source Business Intelligence Software Helical Insight is Here

logo

A Business Intelligence Framework

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments