弹簧重试在第二级方法上不起作用
@Retryable
似乎没有像下面这样研究第二级方法。我看到创建了一个代理,但失败时永远不会重试。sphRemoteCall
一旦我移动到第一级方法,比如,它就开始工作了。@Retryable
getSubscriberAccount
示例如下:
@Service
public class SphIptvClient extends WebServiceGatewaySupport {
//Works over here
@Retryable(maxAttempts=3, backoff=@Backoff(delay=100))
public GetSubscriberAccountResponse getSubscriberAccount(String loginTocken, String billingServId) {
GetSubscriberAccountResponse response = (GetSubscriberAccountResponse) sphRemoteCall(sphIptvEndPoint, getSubAcc, "xxxxx");
return response;
}
/*
* Retryable is not working on the 2nd level methods in the bean.
* It works only with methods which are called directly from outside
* if there is 2nd level method, like this, Retryable is not working.
*/
//@Retryable
private Object sphRemoteCall(String uri, Object requestPayload, String soapAction) {
log.debug("Calling the sph for uri:{} and soapAction:{}", uri, soapAction);
return getWebServiceTemplate().marshalSendAndReceive(uri, requestPayload, new SoapActionCallback(soapAction));
}
}
@Configuration
@EnableRetry
public class SphClientConfig {
@Bean
public SphIptvClient sphIptvClient() {
SphIptvClient client = new SphIptvClient();
return client;
}
}