When creating a sniffer for the new rest client you need to provider two instances of the RestClient. Should these be different instances with a different configuration? In the next line of code I create a sniffer using two restClient instances.
The responsibility of the HostsSniffer is to find the hosts. If I am right, the HostsSniffer uses the provided restClient2 to connect to the cluster and finds the hosts. Than the Sniffer uses the hosts as provided by the HostsSniffer to store them into the restClient1 as given to the Sniffer.
So the question is, should restClient1 be the same as restClient2? If so, why do I need to provide it twice? If not, what is the difference?
Hi Jettro,
sorry for the delay.
You got it right, you have to provide the RestClient twice. The reason for this is that the HostsSniffer is the component that gets the hosts, while the Sniffer is the one that sets the hosts (calls RestClient#setHosts). In the ordinary usecase the REST client instance is the same in both cases. It could happen though that HostsSniffer is a custom one and takes hosts from somewhere else (not even an es cluster potentially) hence why the separation. I will see if I can add a simpler way to create the needed objects for the ordinary usecase though.
then the HostsSniffer gets automatically created against that same client. It is still possible to provide a HostsSniffer in case the default configuration has to be changed or the impl needs to be different:
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.