OnComponentError - Log the error and go to the next record
Hi Team,
In my parent job, the input is the csv file and run the sequence of subjob by onComponentOk event.
For each record of input file the sequence of subjob has to be executed. In each subjobs i have checked the checkbox "die on error" to true of tSalesforceOutput component.
Please refer ETLJob image
My requirement: For a particular record if any of subjob is failed at any sequence, I want to login into the output file, and want to continue with the next record of the input csv file.
Steps followed:
1. I searched on talend forum, and found i can populate the error message as one of the context variable and i can pass it.
2. So onComponentError i adding one tJavaFlex to populate error message and attaching with the output file in each subjob. Please refer LogError_OnComponentOk image
I have a idea of create new job to log a errormessage(have tJavaFlex and output file), and attach that job of on onComponentError to present this job simple.
Where I struck up ? After logging the error message in the output file,where/how can I write code to move to the next record of my INPUT csv file.
Kindly suggest me how to go about it.
Dear user
To capture the error message, you should the tLogCapture component. The job design looks like:
parent job:
tFileInputDelimited(read each row from file)---main--tFlowToIterate---iterate--tRunJob(call the child job)
on tRunJob, uncheck the option 'die on error', it will continue to process next records even the child job has an error, pass each row to child job via context variables.
Child job:
tFixedFlowInput--main--tSalesforOutput
tLogCapture--main--tFileOutputDelimited
on tFixedFlowInput, generate each row passed from the parent job. see the following topic to know how to pass each row from parent job to child job:
https://community.talend.com/t5/Design-and-Development/Dynamically-run-a-job/td-p/68161 on tSalesForOutput, check the option 'die on error'
on tFileOutputDelimited, check the option 'append' to append each error message to the existing file if needed.
Best regards
Shong
Shong,
Thanks for your reply, in child job you mentioned as
1. tFixedFlowInput--main--tSalesforOutput
2. tLogCapture--main--tFileOutputDelimited.
I am reading and browsing how to use tFixedFlowInput.
I am not sure where to place the components in my child jobs(subjobs).
Please have a look on my child jobs and suggest me.