One Star

Problem with catch exception in route calling job

Hi,
let me explain my problem : i've got a route begining with a WS Rest, then calling a cTalendJob, and finally putting the message in a jms queue. The job called by the route is a simple insert of the message in a database with a stored procedure (tOracleSP). I want to catch exceptions in the whole process so i put a try/catch(Exception.class) in the route just before the cTalendJob.
When a message is received, it is stored in DB and put in the queue => OK.
When an error occur for example because of a primary key violation in DB storing, the 'catch' route is used and the error is correctly handled => OK.
But after an error, all following messages are handled as errors in the route, even if they are well stored in DB => KO !
How can i reinitilize the error context after an error ?
Thank you for helping.
2 REPLIES
Community Manager

Re: Problem with catch exception in route calling job

what about using a cOnException component :
https://help.talend.com/search/all?query=cOnException&content-lang=en
HTH
One Star

Re: Problem with catch exception in route calling job

Thank you for your answer. But i have the same behavior with cOnException : after the first unique constraint violation, cOnException catch all messages... do my problem come from the job ?
For further explanations, my job begin with a tRouteInput, then a tJDBCSP to insert the message in DB, then a tXMLMap to get the technical identifier, and finally a tRouteOutput. Besides, i put a tAssertCatcher + tMap +tRouteOutput to set header properties relative to the error.