With the typical HttpAsyncClients
example:
public class AsyncClientHttpExchange {
public static void main(final String[] args) throws Exception {
CloseableHttpAsyncClient httpclient = HttpAsyncClients.createDefault();
try {
httpclient.start();
HttpGet request = new HttpGet("http://httpbin.org/get");
Future<HttpResponse> future = httpclient.execute(request, null);
HttpResponse response = future.get();
System.out.println("Response: " + response.getStatusLine());
System.out.println("Shutting down");
} finally {
httpclient.close();
}
System.out.println("Done");
}
}
What is the way to set the number of retries in case there is no response?. I can see 5.
With httpClientBuilder
there is the setRetryHandler
:
httpClientBuilder.setRetryHandler(new MyRequestRetryHandler(_maxRetryCount));
What is the way with HttpAsyncClients
?
HttpAsyncClient 4.x does not support automatic request re-execution. This feature is planned for HttpAsyncClient 5.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With