Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Lorenzo5
Creator
Creator

tSalesforceConnection retry mechanism

Hi,

I'm looking for implementing a retry mechanism for the tSalesforceConnection component, instead of having it failing (e.g. in case of Salesforce Remote Server temporary unavailable) and the Job going to terminate.

As the component raises an exception which breaks any outer loop, I was not able to develop and retry loop solution. Nevertheless, I might have missing something.

Any idea about a possible retry loop design for the tSalesforceConnection component?

A simple design as test:

0695b00000fJzBWAA0.png 

0695b00000fJzBgAAK.png 

Regards.

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Hello,

We could use the tJavaflex component with the following code to enable the retry option for tsalesforcexxx component.

//begin

Exception lastException = null;

int i = 0;

for( ; i < 5 ;i++) {

try {

 

//main

//intentionally empty

 

//end

i = 10;

} catch (Exception e) {

lastException = e;

log.warn("Failed to connect, will retry after " + (i*2) + "seconds. Exception: " + e.getMessage() );

Thread.sleep(i*2*1000);

}

}

//we had an exception

if(i != 10) throw lastException;

Feel free to let us know if it helps.

Best regards

Sabrina

View solution in original post

5 Replies
Anonymous
Not applicable

Hello,

We could use the tJavaflex component with the following code to enable the retry option for tsalesforcexxx component.

//begin

Exception lastException = null;

int i = 0;

for( ; i < 5 ;i++) {

try {

 

//main

//intentionally empty

 

//end

i = 10;

} catch (Exception e) {

lastException = e;

log.warn("Failed to connect, will retry after " + (i*2) + "seconds. Exception: " + e.getMessage() );

Thread.sleep(i*2*1000);

}

}

//we had an exception

if(i != 10) throw lastException;

Feel free to let us know if it helps.

Best regards

Sabrina

Lorenzo5
Creator
Creator
Author

Hi @Xiaodi Shi​ 

Thanks! The solution works very well, and I was succesfully able to catch the tSalesforceConnection exception and retry the connection multiple time.

 

Unfortunately, I have another issue.

I included the "Retrying Connection design" in a Joblet, in order to share it with several Jobs, but when I include the Joblet in a Job, that Job is aware and knows the connection, but it's unable to use it, which is quite weird to me.

For that reason, I'm creating a new post, here:

 

Joblet does not actually share a Salesforce Connection with its parent Job (talend.com)

 

Regards,

Lorenzo

Anonymous
Not applicable

Hello @Lorenzo Lucioni​ 

We replied to your another topic about: Joblet does not actually share a Salesforce Connection with its parent Job.

Could you please have a look at it to see if it helps?

https://community.talend.com/s/question/0D55b00008dI0aLCAS/joblet-does-not-actually-share-a-salesfor...

Best regards

Sabrina

 

Lorenzo5
Creator
Creator
Author

Hi Sabrina,

saw your answer there, unfortunately it was not helpful, as it seems to me we are here facing a bug. That thread continues.

 

Thanks anyway for your support for this specific thread, the try/catch solution with the tJavaFlex component works very well.

The try/catch topic has been a critical topic on some of my Jobs... and wrapping everything valley of the tJavaFlex with that try/catch is very helpful.

 

Regards,

Lorenzo

Lorenzo5
Creator
Creator
Author

Just for the records, my solution (with a wider use of Components, instead of Java code into the tJavaFlex Component):

0695b00000fKNkuAAG.png