Search code examples
talend

How to connect Talend tHashInput to tHashOutput from other job


[I'm an experienced DataStage developer moving to Talend. Trying to relate concepts.]

I have the following job in DataStage which I categorize as a "sync" job as its purpose is to synchronize the contents in two tables on different servers. It is effectively a two-pass job but utilizes the same two hash tables without requiring the reading of the two sources tables on both passes. The tables are read once, hash tables are populated, then the hash tables serve as both feed and lookup for each of the passes

enter image description here

I'm trying to build a similar job in Talend ESB and have most of it working but can't figure out how to tie the hash tables together. I understand about the need to select the associated component in the tHashInput properties.

I know I can use the "On Component OK" triggers off of the two hash tables in the upper job and tie them to the start hash table of the lower job. But when I run, the second job fails because the APPLCODE_SRC job has not been initialized -- which I don't understand since it should be there and completed before the second job even starts -- unless I don't understand what "On Component OK" really means.

enter image description here

I also tried using the upper component in a tRunJob. Here, I can link the two using "On Subjob Ok" but there is no way to associate the hash tables between the jobs. The component list is empty for the tHashInput properties.

enter image description here

I tried finding a way to persist the hash tables between jobs but didn't see anything there.


Solution

  • The first subjob you did doesn't look too bad, it should work (the first grey rectangle).

    What you should do in the next subjob, is remove the OnComponentOk triggers, and use a single OnSubjobOk trigger to link the 2 subjobs together. It would go from the startable component of the 1st subjob (tMSSqlInput_1) to the startable component of the 2nd subjob (tHashInput_1).
    A startable component is recognized by its green background.

    Also, tHashInput components can only see tHashOuput components that are in the same job, so in your 2nd screenshot, as you have them in a child job, it won't work.