Class SnifferBuilder

java.lang.Object
org.opensearch.client.sniff.SnifferBuilder

public final class SnifferBuilder extends Object
Sniffer builder. Helps creating a new Sniffer.
  • Field Details

    • DEFAULT_SNIFF_INTERVAL

      public static final long DEFAULT_SNIFF_INTERVAL
      The default sniff interval (in milliseconds).
    • DEFAULT_SNIFF_AFTER_FAILURE_DELAY

      public static final long DEFAULT_SNIFF_AFTER_FAILURE_DELAY
      The default delay of a sniff execution after a failure (in milliseconds).
  • Method Details

    • setSniffIntervalMillis

      public SnifferBuilder setSniffIntervalMillis(int sniffIntervalMillis)
      Sets the interval between consecutive ordinary sniff executions in milliseconds. Will be honoured when sniffOnFailure is disabled or when there are no failures between consecutive sniff executions.
      Parameters:
      sniffIntervalMillis - the interval between sniff executions in milliseconds.
      Throws:
      IllegalArgumentException - if sniffIntervalMillis is not greater than 0
    • setSniffAfterFailureDelayMillis

      public SnifferBuilder setSniffAfterFailureDelayMillis(int sniffAfterFailureDelayMillis)
      Sets the delay of a sniff execution scheduled after a failure (in milliseconds).
      Parameters:
      sniffAfterFailureDelayMillis - the sniff delay in milliseconds.
    • setNodesSniffer

      public SnifferBuilder setNodesSniffer(NodesSniffer nodesSniffer)
      Sets the NodesSniffer to be used to read hosts. A default instance of OpenSearchNodesSniffer is created when not provided. This method can be used to change the configuration of the OpenSearchNodesSniffer, or to provide a different implementation (e.g. in case hosts need to taken from a different source).
      Parameters:
      nodesSniffer - the NodesSniffer instance to be used.
    • build

      public Sniffer build()
      Creates the Sniffer based on the provided configuration.