Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
When you open a project you can set the project level implicit context load to read from a single file.
I was wondering if you can be more fine grained than this if you want to keep context values in different files.
Project level implicit context load only allows you to load from one file.
I was wondering how implicit context load works when you have reference projects.
Can you specify implicit context load in each reference project with different file paths in each reference project?
So reference project1 implicit context loads from file1 and reference project2 implicit context loads from file2.
Then the parent project could reference both reference projects and implicitly load context variables from both files?
Does Talend support this?
Is there another way of using multiple files?
thanks
n
Since passwords are Strings (or can be if you are encrypting them), you can simply extrapolate from the following code as an example of how you would encrypt/decrypt those Strings.
import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
//Configure encryptor class StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor(); encryptor.setAlgorithm("PBEWithMD5AndDES"); encryptor.setPassword("BOB"); //Set the String to encrypt and print it String stringToEncrypt = "Hello World"; System.out.println(stringToEncrypt); //Encrypt the String and store it as the cipher String. Then print it String cipher = encryptor.encrypt(stringToEncrypt); System.out.println(cipher); //Decrypt the String just encrypted and print it out System.out.println(encryptor.decrypt(cipher));
The Implicit Context Load will load the Context Variables behind the scenes. To alter the encrypted values, all you need to do is place a tPreJob into your job with a tJava component attached. You can then decrypt there. The rest of the job will start after this has been done.
Ahh okay - I'd get a handle on the encrypted values in a pre-job.
cheers for all your help!
No problem at all 🙂
Congrats for your article mentioned above. It is really helpful! I have one question: I am using Implicit context loading from file. How could I load the context only in parent jobs? I Know you did it using the "where" clause and rootId, jobID variables, but loading from file, a FileNotFoundException raises if a correct file path is not given. Thanks!
If I understand you correctly, you will have a parent job which contains several child jobs. You only want to use the implicit context load in the parent. Is that correct? If so, you can do the following.
Look at this job tab below.....
You will see that the "Use Project Settings" tickbox is ticked. Untick this and you will be able to set the "Implicit tContextLoad" tickbox. You will see this when it is done....
Here you can set up your parameters.
In your child jobs, make sure that the Implicit Context Load is not set.
Thanks for your quick answer.
After several days of reading many articles about Talend context I am really confused about which of these approaches is more suitable.
A) Implicit context load from file in all jobs (parent and child). Context variables values in child jobs will not be overridden by values from parent job unless they don´t exist in the external file. https://community.talend.com/s/article/Implicit-Context-Load-usage-in-both-parent-and-child-jobs-0GoRi?language=en_US
B) Implicit context load from file only in parent jobs. I must add all context variables in parent job and pass them to sub-jobs through Transmit whole context.
Considering your experience ¿which one would you advise? Would be there any difference in terms of eficciency?
I would be really gratefull if you could help me to clarify this issue.
First of all, it very much depends on what you intend to do with Talend. If you are working with Talend Cloud, it might make more sense to use the context variable configuration built in to that. It can certainly aid with ensuring your whole team are working with the same variables. But if you are using Talend Open Studio, you don't need to worry about that.
With regard to the choices above, I would probably go with Implicit Context Load for the parent jobs only. You have to make sure you set up the child jobs to receive the context values from the parent though.
Thanks again for your help.
I´m using Talend Open Studio and I export my jobs as executable batch files. Considering the second option: is it recommended to use Transmit whole context option to send all of my context variables to the child jobs? or is it a bad practice that causes the programming to be heavy?
You can manually specify the context variables that are sent to the child job if you prefer. Clicking the option to send everything is just quicker and requires less maintenance.
Thanks again. I really appreciate your help.