Class HttpLookupService

java.lang.Object
org.apache.pulsar.client.impl.HttpLookupService
All Implemented Interfaces:
AutoCloseable, LookupService

public class HttpLookupService extends Object implements LookupService
  • Constructor Details

    • HttpLookupService

      public HttpLookupService(ClientConfigurationData conf, io.netty.channel.EventLoopGroup eventLoopGroup) throws org.apache.pulsar.client.api.PulsarClientException
      Throws:
      org.apache.pulsar.client.api.PulsarClientException
  • Method Details

    • updateServiceUrl

      public void updateServiceUrl(String serviceUrl) throws org.apache.pulsar.client.api.PulsarClientException
      Description copied from interface: LookupService
      Instruct the LookupService to switch to a new service URL for all subsequent requests.
      Specified by:
      updateServiceUrl in interface LookupService
      Throws:
      org.apache.pulsar.client.api.PulsarClientException
    • getBroker

      public CompletableFuture<org.apache.commons.lang3.tuple.Pair<InetSocketAddress,InetSocketAddress>> getBroker(org.apache.pulsar.common.naming.TopicName topicName)
      Calls http-lookup api to find broker-service address which can serve a given topic.
      Specified by:
      getBroker in interface LookupService
      Parameters:
      topicName - topic-name
      Returns:
      broker-socket-address that serves given topic
    • getPartitionedTopicMetadata

      public CompletableFuture<org.apache.pulsar.common.partition.PartitionedTopicMetadata> getPartitionedTopicMetadata(org.apache.pulsar.common.naming.TopicName topicName)
      Description copied from interface: LookupService
      Returns PartitionedTopicMetadata for a given topic.
      Specified by:
      getPartitionedTopicMetadata in interface LookupService
      Parameters:
      topicName - topic-name
      Returns:
    • getServiceUrl

      public String getServiceUrl()
      Description copied from interface: LookupService
      Returns broker-service lookup api url.
      Specified by:
      getServiceUrl in interface LookupService
      Returns:
    • resolveHost

      public InetSocketAddress resolveHost()
      Description copied from interface: LookupService
      Resolves pulsar service url.
      Specified by:
      resolveHost in interface LookupService
      Returns:
      the service url resolved to a socket address
    • getTopicsUnderNamespace

      public CompletableFuture<org.apache.pulsar.common.lookup.GetTopicsResult> getTopicsUnderNamespace(org.apache.pulsar.common.naming.NamespaceName namespace, org.apache.pulsar.common.api.proto.CommandGetTopicsOfNamespace.Mode mode, String topicsPattern, String topicsHash)
      Description copied from interface: LookupService
      Returns all the topics name for a given namespace.
      Specified by:
      getTopicsUnderNamespace in interface LookupService
      Parameters:
      namespace - : namespace-name
      Returns:
    • getSchema

      public CompletableFuture<Optional<org.apache.pulsar.common.schema.SchemaInfo>> getSchema(org.apache.pulsar.common.naming.TopicName topicName)
      Description copied from interface: LookupService
      Returns current SchemaInfo SchemaInfo for a given topic.
      Specified by:
      getSchema in interface LookupService
      Parameters:
      topicName - topic-name
      Returns:
      SchemaInfo
    • getSchema

      public CompletableFuture<Optional<org.apache.pulsar.common.schema.SchemaInfo>> getSchema(org.apache.pulsar.common.naming.TopicName topicName, byte[] version)
      Description copied from interface: LookupService
      Returns specific version SchemaInfo SchemaInfo for a given topic.
      Specified by:
      getSchema in interface LookupService
      Parameters:
      topicName - topic-name
      version - schema info version
      Returns:
      SchemaInfo
    • close

      public void close() throws Exception
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception