Class DruidLeaderClient


  • public class DruidLeaderClient
    extends Object
    This class facilitates interaction with Coordinator/Overlord leader nodes. Instance of this class is injected via Guice with annotations @Coordinator or @IndexingService . Usage: Request request = druidLeaderClient.makeRequest(HttpMethod, requestPath) request.setXXX(..) FullResponseHolder responseHolder = druidLeaderClient.go(request)
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      String findCurrentLeader()  
      org.apache.druid.java.util.http.client.response.StringFullResponseHolder go​(org.apache.druid.java.util.http.client.Request request)
      Executes a Request object aimed at the leader.
      <T,​H extends org.apache.druid.java.util.http.client.response.FullResponseHolder<T>>
      H
      go​(org.apache.druid.java.util.http.client.Request request, org.apache.druid.java.util.http.client.response.HttpResponseHandler<H,​H> responseHandler)
      Executes a Request object aimed at the leader.
      org.apache.druid.java.util.http.client.Request makeRequest​(org.jboss.netty.handler.codec.http.HttpMethod httpMethod, String urlPath)
      Make a Request object aimed at the leader.
      void start()  
      void stop()  
    • Constructor Detail

      • DruidLeaderClient

        public DruidLeaderClient​(org.apache.druid.java.util.http.client.HttpClient httpClient,
                                 DruidNodeDiscoveryProvider druidNodeDiscoveryProvider,
                                 NodeRole nodeRoleToWatch,
                                 String leaderRequestPath)
    • Method Detail

      • start

        public void start()
      • stop

        public void stop()
      • makeRequest

        public org.apache.druid.java.util.http.client.Request makeRequest​(org.jboss.netty.handler.codec.http.HttpMethod httpMethod,
                                                                          String urlPath)
                                                                   throws IOException
        Make a Request object aimed at the leader. Throws IOException if the leader cannot be located.
        Throws:
        IOException
      • go

        public org.apache.druid.java.util.http.client.response.StringFullResponseHolder go​(org.apache.druid.java.util.http.client.Request request)
                                                                                    throws IOException,
                                                                                           InterruptedException
        Executes a Request object aimed at the leader. Throws IOException if the leader cannot be located. Internal retries with cache invalidation are attempted if 503/504 response is received.
        Parameters:
        request -
        Throws:
        IOException
        InterruptedException
      • go

        public <T,​H extends org.apache.druid.java.util.http.client.response.FullResponseHolder<T>> H go​(org.apache.druid.java.util.http.client.Request request,
                                                                                                              org.apache.druid.java.util.http.client.response.HttpResponseHandler<H,​H> responseHandler)
                                                                                                       throws IOException,
                                                                                                              InterruptedException
        Executes a Request object aimed at the leader. Throws IOException if the leader cannot be located. Internal retries with cache invalidation are attempted if 503/504 response is received.
        Parameters:
        request -
        responseHandler -
        Throws:
        IOException
        InterruptedException
      • findCurrentLeader

        public String findCurrentLeader()