Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a user case where I have data in queue (like Active MQ) where I am calling it in route and sending it to DI job using cTalendJob,
where in DI job i want to store it into database. But if database server is not working like (service is not working , connection failed due network issue) i am loosing my queue. So, I don't want to lose my data in queue.
I want to know if there any component where It can wait until connection can reestablish the connection.
You should not use a tDie in a cTalendJob route job. tDie are for batch job, not for route.
You should use a tRouteFault and throw back a fault into the orchestration route. And just before calling the cTalendJob, add a cJavaDSLProcessor with the code .handleFault().
Your cMQConnectionFactory should have transaction checked.
Also why are you doing a tFlowToIterate in the job? You can extract the body values of the tRouteInput directly using a tMap or tXMLMap and send to the MySQLOutput.
The tRouteFault should be onSubjobErrror on tRouteInput.
Hi,
From your description, you can try to build a loop in your work flow.
Here is a tInfiniteLoop component which allows you to execute a task or a job automatically, based on a loop. Or You can have a look at tSleep component which implements a time off in a Job execution.
Best regards
Sabrina
Even I use the tSleep i will loose my queue so, what i am trying to achieve is same use-case while using twaitforfile where I have to wait until db connection is established
Are you using transaction on the cMQConnectionFactory? If you are in a transaction, you should be able to abort the transaction and that should not take the message off the queue. Are you reading the message from the queue in the DI job or on the route itself?
My usecase is get the queue in route and send it to the DI job which will store the queue in DB but for some reason if DB is not working i am loosing my queue how can i prevent my queue from loosing the data
You should not use a tDie in a cTalendJob route job. tDie are for batch job, not for route.
You should use a tRouteFault and throw back a fault into the orchestration route. And just before calling the cTalendJob, add a cJavaDSLProcessor with the code .handleFault().
Your cMQConnectionFactory should have transaction checked.
Also why are you doing a tFlowToIterate in the job? You can extract the body values of the tRouteInput directly using a tMap or tXMLMap and send to the MySQLOutput.
The tRouteFault should be onSubjobErrror on tRouteInput.
I am in a similar situation on Talend Data Service Platform 6.2.1 despite my Talend Job is not about MySQL.
I tried to add a cJavaDSLProcessor with .handleFault() method but I always got an error like "The method .handleFault() is not defined for the type ExpressionNode" (or similar if I add a cTry block before). What am I doing wrong?
Here is the interested part of my route:
.to("file://" + context.message_dir + "?noop=true" + "&autoCreate=true" + "&flatten=false" + "&fileName=refund_${in.header.ProcessingDate}_${in.header.platform}_order_${in.header.OrderNumber}.json" + "&charset=UTF-8" + "&bufferSize=128") .id("RefundESBMagento_cFile_1") .handleFault().id("RefundESBMagento_cJavaDSLProcessor_1") .to(endpoint_cTalendJob_1).id("RefundESBMagento_cTalendJob_1") .convertBodyTo(String.class)
Thanks in advance,
Manuel
I got the answer just reading some articles on Camel Documentation.
The .handleFault() needs to be added just after the first component of the Route.
Hello,
Thanks for sharing your solution on forum.
Best regards
Sabrina