Interface LookupService

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
BinaryProtoLookupService, HttpLookupService

public interface LookupService extends AutoCloseable
Provides lookup service to find broker which serves given topic. It helps to lookup
  • topic-lookup: lookup to find broker-address which serves given topic
  • Partitioned-topic-Metadata-lookup: lookup to find PartitionedMetadata for a given topic
  • Method Details

    • updateServiceUrl

      void updateServiceUrl(String serviceUrl) throws org.apache.pulsar.client.api.PulsarClientException
      Instruct the LookupService to switch to a new service URL for all subsequent requests.
      Throws:
      org.apache.pulsar.client.api.PulsarClientException
    • getBroker

      CompletableFuture<org.apache.commons.lang3.tuple.Pair<InetSocketAddress,InetSocketAddress>> getBroker(org.apache.pulsar.common.naming.TopicName topicName)
      Calls broker lookup-api to get broker InetSocketAddress which serves namespace bundle that contains given topic.
      Parameters:
      topicName - topic-name
      Returns:
      a pair of addresses, representing the logical and physical address of the broker that serves given topic
    • getPartitionedTopicMetadata

      CompletableFuture<org.apache.pulsar.common.partition.PartitionedTopicMetadata> getPartitionedTopicMetadata(org.apache.pulsar.common.naming.TopicName topicName)
      Returns PartitionedTopicMetadata for a given topic.
      Parameters:
      topicName - topic-name
      Returns:
    • getSchema

      CompletableFuture<Optional<org.apache.pulsar.common.schema.SchemaInfo>> getSchema(org.apache.pulsar.common.naming.TopicName topicName)
      Returns current SchemaInfo SchemaInfo for a given topic.
      Parameters:
      topicName - topic-name
      Returns:
      SchemaInfo
    • getSchema

      CompletableFuture<Optional<org.apache.pulsar.common.schema.SchemaInfo>> getSchema(org.apache.pulsar.common.naming.TopicName topicName, byte[] version)
      Returns specific version SchemaInfo SchemaInfo for a given topic.
      Parameters:
      topicName - topic-name
      version - schema info version
      Returns:
      SchemaInfo
    • getServiceUrl

      String getServiceUrl()
      Returns broker-service lookup api url.
      Returns:
    • resolveHost

      InetSocketAddress resolveHost()
      Resolves pulsar service url.
      Returns:
      the service url resolved to a socket address
    • getTopicsUnderNamespace

      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 topicPattern, String topicsHash)
      Returns all the topics name for a given namespace.
      Parameters:
      namespace - : namespace-name
      Returns: