elasticsearch-java icon indicating copy to clipboard operation
elasticsearch-java copied to clipboard

Transport level retry

Open l-trotta opened this issue 9 months ago • 0 comments

Adds new retry functionality to the client, configurable in the Transport options like so:

        RestClient restClient = RestClient
            .builder(new HttpHost(address.getHostString(), address.getPort(), "http"))
            .build();

        // setting transport option
        RestClientOptions options = new RestClientOptions(RequestOptions.DEFAULT, false,
            BackoffPolicy.constantBackoff(50L, 8));

        ElasticsearchTransport transport = new RestClientTransport(
            restClient, new JacksonJsonpMapper(), options);

        ElasticsearchAsyncClient esClient = new ElasticsearchAsyncClient(transport);

Some doubts remaining in the form of TODOs in the code. (they break checkstyle ignore it for now)

Unit tests available in TransportTest.class

l-trotta avatar Mar 03 '25 17:03 l-trotta