Six Stars

How to check if SQL service is working or not

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.

  • Data Integration
  • ESB
Tags (4)
1 ACCEPTED SOLUTION

Accepted Solutions
Employee

Re: How to check if SQL service is working or not

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.

5 REPLIES
Moderator

Re: How to check if SQL service is working or not

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

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Six Stars

Re: How to check if SQL service is working or not

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 

Employee

Re: How to check if SQL service is working or not

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? 

Six Stars

Re: How to check if SQL service is working or not

2017-06-29 11_16_46-Talend Data Fabric (6.3.1.20161216_1026) _ ESBDemo (Connection_ Local).png2017-06-29 11_17_01-Talend Data Fabric (6.3.1.20161216_1026) _ ESBDemo (Connection_ Local).png

 

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

Employee

Re: How to check if SQL service is working or not

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.