Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I want to count number of records for CampaignMember table from SalesForce.
But Sometimes it gives me "org.apache.axis2.AxisFault:Read timed out" for tSalesforceinput component for only CampaignMember object ,other objects have no problem.
That's why i want to retry this process 2 times using tLoop as shown below but again for CampaignMember object when it fails it doesn't retry.
Can any one resolve my issue and provide me solution over this?
Thanks,
vaibhav
Hi,
Sorry for late reply......!
The issue is solved now but with different approach .
I uses one more tRunJob to retry the job on my expected condition. Also uses tBufferOutput component to transfer parameters back to Master Job.
Design is like this:
Master job-->tRunJob_1-->Child Job-->If error comes -->tBufferOutput--->Master Job-->If Error recorded-->tRunJob_2-->process repeats ....
Master jOb-
Child Job-
This is down to an error in your Java. By the way, thanks for the screenshots, but with code it is easier if you copy and paste it into the forum. It allows us to edit it for you
Please excuse typos in the code examples.
Your loop condition should be like below.....
((String)globalMap.get("LoopIterate")).compareToIgnoreCase("Start")==0
You are comparing the exact value. You are saying "Is the value of my globalMap variable THIS value?". It's subtle but it is like saying that two cars are the same. They may be the same make, model, year, colour.....they may even have the same number plate. They may look EXACTLY the same. But they are different cars. The "==" checks for that. You want to compare the value.
The second issue is with the first line of your IF condition in the tJava. There is a relatively famous saying which goes "You can say someone is a waste of space, but not a waste of null". Null is nothing. It is the non existence of something. You are treating as a String with the value "null". What you want to use is below (again, the code is pseudo code, but you should get the idea)....
if(globalMap.get("Salesforce_component")==null){ ---do something }else if(........
Try adjusting your code following the above and you will be a step closer. It still may have issues. If so, let us know
You are using an OnComponentOK to link to the tJava. That is likely something to do with this here. You can sort this by changing the approach. Have the globalMap that controls the Loop to be immediately set to the value that will continue the loop before you do anything. Then set that globalMap to be the complete status in the tJava which currently is not being fired. My thinking is that this will only be fired on a successful run. Therefore you should use this to end the loop instead of continue it.
If you are getting an error with the Salesforce component the flow will not get to the tJava. As such, you need to increment a counter before the Salesforce component. I would approach this in the following way...
1) Use an increment counter in your Loop. Also use a While Loop. This can be done with a globalMap variable created before the tLoop (maybe in a tJava).
2) Increment this globalMap variable before the Salesforce component is called.
3) Set the While loop limit to whatever you want (I think you say you wish it to try twice).
4) If the Salesforce component is called successfully and the update is carried out in the DB (ie if the tJava at the end is reached) set the gobalMap varible to be equal or greater than you max loop value.
This *should* solve your issue.
Hi,
tLogCatcher doesn't allow me to divert the flow of execution for retry as previously discussed, now I disable it and handle the incoming error by using "onComponentError" link and attach it further with tJava where I update my tLoop condition .
This will update global variable value from tloop and go for retry. But now again different issue arises though my condition -
if((Integer)globalMap.get("tLoop_1_CURRENT_ITERATION")<3)
{
globalMap.put("LoopIterate", "Start");
System.out.println("Going for Retry for "+context.SF_Table);
}
is true it doesn't pass the flow to tjava also , as I don't get "Going for Retry for" message in error log/trace.
Is there any limitation for OnComponentError link? Does it support all objects i.e. input components as well as output components?
Kindly reply ...!
Vaibhav
The fact that your code is not getting to the the tJava is not because something is going wrong. There is no error on what I suspect your OnComponentError is connected to. The error is occurring on the salesforce component and the flow will likely stop there (I cannot see it, so I am having to guess). That is why I gave the suggestion I did above. You need to have the status (variable settings) set to a state of failure before the Salesforce component so that if the flow stops dead there, it will cycle through again. If the flow gets beyond the Salesforce component then it can be considered a success.
It is very hard to imagine your flow (particularly as you say you have changed it). Can you try what I suggested, test it and send a screen shot with issues?
By the way, the tLogCatcher just intercepts logs. It does not change the flow. You can see how it is supposed to be used by looking at the link below.
https://help.talend.com/display/TalendOpenStudioComponentsReferenceGuide61EN/tLogCatcher
Hi,
Sorry for late reply......!
The issue is solved now but with different approach .
I uses one more tRunJob to retry the job on my expected condition. Also uses tBufferOutput component to transfer parameters back to Master Job.
Design is like this:
Master job-->tRunJob_1-->Child Job-->If error comes -->tBufferOutput--->Master Job-->If Error recorded-->tRunJob_2-->process repeats ....
Master jOb-
Child Job-