Hi, my problem sounds simple: I want to process a file and in case of invalid rows I want the job to return another returncode so that the caller knows that there have been warnings (I treat invalid rows as warnings here - this means not necessarily that a component like tWarn is used). An important thing is, that the job should continue regular and after processing the whole file and the job is finished regularly I want to exit with a modified return code in case of warnings. I played around with tWarn and tDie. When I use tDie, the specified "Error Code" is used as returncode - but tDie doesn't allow to continue proceeding with the job. Using tWarn the job isn't killed, but the "Code" specified isn't used as returncode of the job :-( One possible solution might be to use a tJavaRow to write the returncode to a global variable and at the end of the job check if this is set and call tDie in that case. But this doesn't seem to be the TOS-way to implement this feature for me - maybe I'm wrong, maybe I missed something,....? regards, blackfox
hi, as I noticed now, the job even doesn't get an exitcode other than 0 set when a tLogCatcher catches a tDie. I have solved my problem now as follows (have a look at the attached screenshot): - a logcatcher catches all tWarn und tDie - the message is beeing logged and a tSetGlobalVar sets the "code" from the catched tWarn/tDie to a variable "exitcode" - the last component following tPostJob is a tJava with the following code
So far it seems to work - can someone of the experts or from the talend-team here confirm or disprove this is a proper solution? I'm not sure if I kill the job with this while some postoperations of the job should be executed afterwards and now they aren't...!? regards, blackfox PS: a TODO I'm aware of is that I need to ensure the correct exitcode is set in case there occur different warnings or errors
I like what you did. You could essentially do the same thing you did but do it with a TDie. Use a post job which calls a tDie inside which you put your globalMap.get("myreturncode") as the return code.