A site about Talend
This reusable Job loads Talend Context from a file, in a reliable and consistent way, reducing the programming effort that you need to do in each of your task-specific Jobs. This simplifies both your maintenance, and the promotion of your Jobs through Development, Test and Production.
You may download LibContextReader and import (Job Designs->Import items) in to a Talend Project of your choice. This download is supported by Talend 5.2.0 and above.
You may download LibContextReader and import (Job Designs->Import items) in to a Talend Project of your choice. This download is supported by Talend 5.5.1 and above. This enhanced version supports auto-loading or secondary context files. This allows you to have a fine level of configuration and allows for parameter overriding.
This Job may be added to any other Job (the parent Job). By default, it will read Context from the file $HOME/talend/context/Default.General.cfg
, where $HOME
represents the home directory of the user that is currently executing the Job. If you want to modify the default Context file, then it is recommended that you edit the Component LibContextReader.InitJob.
This Job reads a Context file and then returns data back to the parent Job.
This Job supports the following Context Variables which may be passed from a parent at runtime.
contextDir specifies the location of your Context files. The default value is $HOME/talend/context
where $HOME
represents the home directory of the user that is currently executing the Job. You may override this parameter by passing a value to tRunJob; however, it is recommended that you edit LibContextReader.InitJob if you want to permenently modify the default value.
If you do not use multiple Context, then there is no need to pass this parameter. If you do use multiple Context, for example, Default, Test and Production, then you should set this parameter to contextStr i.e. pass the Context of the parent Job.
Using a single or multiple Context is a personal choice. My preference is for multiple Context.
You may use either a single Context file for all of your Context Variables, or multiple Context files for groups of Context Variables, for example, one for each of your Context Groups.
If you are using multiple Context files, then you should pass the name of the Context group to be read, for example AccountsDatabase
.
Using a single or muitple Context files is a peronal choice. My preference is for multiple Context files.
This Job is added to a parent Job using the tRunJob Component. Once added, you should hit the button Copy Child Job Schema and then connect this Component to a tContextLoad Component using Row->Main. The tContextLoad Component requires no further configuration.
The following screenshot shows an example of parameters being passed. For more information on Context, read our Context Reference.
The tutorial Reusable Context Load Job demonstrates how to use this reusable Job.