Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Using tDie in a subJob for handling a flow

Hi everyone,
I'm new in Talend, and I'm working with a Main Job and Sub Jobs... in the Sub Jobs I'm using tDie to exit in specific events, and I want to use that to redirect the execution in the Main Job as an IF sentence.
An example:
Main Job: 
   Run subJob1: 
   -(on subjobOK)-> Run subJob2
   -(on subJobError)-> tDie
subJob1:
   - CheckFileOnFTP:
      -(IF Exist)-> Load into DB
      -(IF Not Exist)-> tDie
So, when I run de Main Job and the file in the FTP doesn't exist, I get a Java Error... even when I handle the existance of the file with tDie. And if I run only the subJob, the error-handle works fine.
How can I handle this kind of 'exceptions' with Talend? 

0683p000009MAzD.png 0683p000009MB7L.png 0683p000009MBOu.png
Labels (3)
7 Replies
Anonymous
Not applicable
Author

If you do want to steer the job chain based on the return code:
1. uncheck the option in the tRunJob Die On Error.
2. If the if-trigger and use here the tRunJob return value CHILD_RETURNCODE (Integer) to decide which tRunJob should called next.
Anonymous
Not applicable
Author

Thank you Jan,
Works fine 0683p000009MA9p.png, now I can handle our own return codes in order to be more specific about the messages of ending jobs.
But if I use a tPostjob, it will override the Return Code of any tDie and return 1, even when I put a tLogCatcher on the tPostjob.
So, how can I get my return codes from a Child Job who have tPostjob?
Anonymous
Not applicable
Author

Hi JSeverino,
I raised a Talend Jira about this bug and they claimed it is not a bug. Apparently it is perfectly acceptable for a tDie error code not to be returned to the parent job IF the child job uses a tPostJob. My reaction to that is.....probably not appropriate to be written here. However, I wrote some code which provides a workaround to this. It is described in the Jira which is here:  https://jira.talendforge.org/browse/TDI-36963
If you agree that this needs fixing, please comment on the Jira.
Anonymous
Not applicable
Author

Hi, indeed it is a bit weird behaviour the error code does not survive a tPostJob processing. Because if that, I usually have following procedure:
I always inspect the globalMap for keys ending with ERROR_MESSAGE and DIE_CODE and take this value as real exist code by setting the member variable this.errorCode.
Anonymous
Not applicable
Author

Hi Richard.
Thanks for answer. 
I'm agree. I use tPostjob for logging status, so I need to keep the final status (in this case given by the tDie component)...
By the moment I'll avoid the use of tPostjob.. that's sad because I think is a very useful component 0683p000009MPcz.png
Anonymous
Not applicable
Author

Thanks Jan,
Your prodecure sounds like the way we must handle this.
0683p000009MA9p.png
Anonymous
Not applicable
Author

That is what the code I posted in the Jira does.