On 10/11/2023 15:31, Konrad Windszus wrote:
HI,
I am using the Fluent API with HttpClient 4.5 like this:
Executor.newInstance(myClient).execute(myRequest).handleResponse(myResponseHandler)
[1]
Although “myClient" is setup with the default HttpRequestRetryHandler this
isn’t triggered when myResponseHandler throws an IOException on an idempotent
request method.
OTOH I can trigger it when I call CloseableHttpClient.execute(HttpUriRequest,
ResponseHandler)[1] and the given response handler throws an IOException.
This is not really clear from the javadoc.
What is the best way to implement a retry for the Fluent API without doing it
completely manually?
Thanks,
Konrad
[1] -
https://hc.apache.org/httpcomponents-client-4.5.x/current/fluent-hc/apidocs/org/apache/http/client/fluent/Executor.html#execute(org.apache.http.client.fluent.Request)
[2] -
https://hc.apache.org/httpcomponents-client-4.5.x/current/httpclient/apidocs/org/apache/http/impl/client/CloseableHttpClient.html#execute(org.apache.http.client.methods.HttpUriRequest,%20org.apache.http.client.ResponseHandler)
Hi Konrad
This is not a problem with the fluent APIs as such, rather it is a
general limitation of the classic I/O transport. The response body
processing takes place outside the protocol handling chain and there is
nothing we can do about it. What we could do though is provide an extra
recovery mechanism for `HttpRequestHandler` expressions. Feel free to
raise a ticket in JIRA for this feature request. Please do note though
this can only be done in the 5.x code line.
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org