-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
I am using feign 9.5.1. In one interface I am doing POST, PUT and GET methods. I am OK with GET methods being retried on IOException coming from client (for instance, readTimeout etc.). Still I find it quite dangerous to retry POST/PUT methods.
In the Retryer interface I have no way of knowing what HTTP method was being used on this particular request (continueOrPropagate method accepts only RetryableException). Also, the method feign.FeignException#errorExecuting is static and for all IOException throws RetryableExcetpion. I haven't seen any easy way of altering this behaviour when studying the code of feign.SynchronousMethodHandler...
Response response;
try {
response = this.client.execute(request, this.options);
response.toBuilder().request(request).build();
} catch (IOException var15) {
if(this.logLevel != Level.NONE) {
this.logger.logIOException(this.metadata.configKey(), this.logLevel, var15, this.elapsedTime(start));
}
throw FeignException.errorExecuting(request, var15);
}
-
Making errorExecuting method of FeignException static and not allowing to impact for what requests to throw RetryableExcetpion is a poor design
-
Putting into RetryableExcetion or FeignException information on what request lead to the exception might solve the problem, as the developer could have more control over when to retry. After all, information about the request is being passed to FeignException.errorExecuting method.