Possible to set number of retries for client stub?

arw's picture

Hi,

I'm having a sort of problem here; I can't figure out how to set the number of times a client-stub will retry connection before giving up and throwing an exception. I've scoured the internet to no avail :(

Basically I'm looking for some setting or mechanism that would allow me to set the number of times a stub retries its connection to the end point before giving up. Preferably it would be possible for it to simply try once and then immediately fail rather than retrying at all.

Is this possible at all? I have not been able to find any documentation on it.

I'd appreciate any insight anyone has.

deepal's picture

  With just using Axis2 you

  With just using Axis2 you can not tell a number of retries that Axis2 use before it throws an exception. One thing you can do is you can write your client so that it will call your stub few times and throw exception each time it get the connection exception. Or else we can use something like Reliable messaging mechanism. That that layer will taking care of that , and even you can configure number of re tries you want to make.
arw's picture

Hmm, maybe it's just me but

Hmm, maybe it's just me but this seems like a pretty big shortcoming in Axis2... of course I'm not terribly familiar with the internal workings but it doesn't seem like it should be that complicated to simply set the retry count :( Also I don't believe I can simply catch the ConnectException; the generated stub method call only throws a RemoteException which occurs after 3 timeouts (ConnectExceptions). These appear to be caught internally in the client stub. Currently we're generating the client using the WSDL2Code feature of WSAS and I'd rather not have to make manual changes if at all possible. Anyway thanks for the reply; if anyone else has any other suggestions they would still be appreciated :D
afkham_azeez's picture

This is not a major

This is not a major shortcoming. The stub & stub generation tools (we will have to add another option to specify the retries) have been kept as simple as possible. If you need to do advanced stuff, you always have the option of handling it in your client which calls the stub or using WS-RM.     Regards Afkham Azeez
ph83nam.yahoo.com's picture

I have the same problem. I'm

I have the same problem. I'm using Axis2 1.5.1/httpclient 3.1. I want to disable request retrying.

After debugging the source code I have this code that works for me:

HttpMethodParams methodParams = new HttpMethodParams();

DefaultHttpMethodRetryHandler retryHandler = new DefaultHttpMethodRetryHandler(0, false);

methodParams.setParameter(HttpMethodParams.RETRY_HANDLER, retryHandler);

client.getOptions().setProperty(HTTPConstants.HTTP_METHOD_PARAMS, methodParams);

 

Hope this helps someone!

library project main code
Learn Cloud
Learn
Cloud

The WSO2 Application Server is a reliable application server that can host your enterprise web applications. The WSO2 Application Server as a Service is offered in StratosLive, the WSO2 Platform as a Service. This article explains how a simple web application can be developed and deployed from Carbon Studio to the WSO2 Application Server...

Latest Webinar
Different groups within an organization need to monitor different Key Performance Indicators (KPIs) - An operations team will be interested in the response times of business services and loads of each service,..
Thursday, February 9th 2012, 09.00 AM (PST)

Thursday, February 9th 2012, 10.00 AM (GMT)