ElasticSearh RestHighLevelClient,如何添加重试?

时间:2019-04-30 04:55:44

标签: java elasticsearch

我当前的代码是: 如何在此处添加多个重试? setMaxRetryTimeoutMillis会做什么?

  return new RestHighLevelClient(RestClient.builder(HttpHost.create(esEndPoint))
                .setHttpClientConfigCallback(hacb -> hacb.addInterceptorLast(interceptor))
                .setRequestConfigCallback(
                        new RestClientBuilder.RequestConfigCallback() {
                            @Override
                            public RequestConfig.Builder customizeRequestConfig(RequestConfig.Builder builder) {
                                return builder
                                        .setConnectTimeout((int) TimeUnit.SECONDS.toMillis(CONNECT_TIMEOUT))
                                        .setSocketTimeout((int) TimeUnit.SECONDS.toMillis(SOCKET_TIMEOUT));
                            }
                        }
                )

        );

0 个答案:

没有答案