Sniffing using HighLevelClient in Java


How am I supposed to create a high level rest client with sniffing enabled (6.4.3)? The components (sniffer, listener, clients) depend on each other in such a way it seems impossible.

Here the HighLevelClient takes a builder, but I need to build the low level client to activate sniffing!?

final RestClientBuilder clientBuilder = RestClient.builder(hosts.toArray(new HttpHost[0]));

final RestHighLevelClient highLevelClient = new RestHighLevelClient(clientBuilder); // will build the client !

if (config.sniffEsCluster()) {
final SniffOnFailureListener failureListener = new SniffOnFailureListener();

sniffer = Sniffer.builder(highLevelClient.getLowLevelClient())
.setSniffAfterFailureDelayMillis((int) Duration.ofSeconds(30).toMillis())
.setSniffIntervalMillis((int) Duration.ofMinutes(1).toMillis())

clientBuilder.setFailureListener(failureListener); // builder closed !?

(system) closed #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.