-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
When using httpclient directly, I have the option to set my own retries handler. Example:
https://www.programcreek.com/java-api-examples/?api=org.apache.http.client.HttpRequestRetryHandler
However, when configuring the RestClient with spring-data-elasticseaarch, I only have access to HttpAsyncClientBuilder through TerminalClientConfigurationBuilder#withHttpClientConfigurer, which doesn't allow me to do so (it is probably required that Elasticsearch client would upgrade internal httpclient to 5.x, while now it is using 4.1.4).
I'm also familiar with the ability to override ElasticsearchRestTemplate's execute method :
private ElasticsearchRestTemplate createElasticsearchRestTemplateForElasticsearchOperations(ElasticsearchConverter elasticsearchConverter, RestHighLevelClient elasticsearchClient) {
return new ElasticsearchRestTemplate(elasticsearchClient, elasticsearchConverter) {
@Override
public <T> T execute(ClientCallback<T> callback) {
int retryCount = 0;
T t = null;
// do some logic
return t;
}
};But this doesn't help in all cases, because most APIs are not using execute.
Is there any way to configure my own retries strategy/handler?
If not, can it be added as an enhancement ?
Thank you.