Interface LookupService

  • All Superinterfaces:
    java.lang.AutoCloseable
    All Known Implementing Classes:
    BinaryProtoLookupService, HttpLookupService

    public interface LookupService
    extends java.lang.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 Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.concurrent.CompletableFuture<org.apache.commons.lang3.tuple.Pair<java.net.InetSocketAddress,​java.net.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.
      java.util.concurrent.CompletableFuture<org.apache.pulsar.common.partition.PartitionedTopicMetadata> getPartitionedTopicMetadata​(org.apache.pulsar.common.naming.TopicName topicName)
      Returns PartitionedTopicMetadata for a given topic.
      java.util.concurrent.CompletableFuture<java.util.Optional<org.apache.pulsar.common.schema.SchemaInfo>> getSchema​(org.apache.pulsar.common.naming.TopicName topicName)
      Returns current SchemaInfo SchemaInfo for a given topic.
      java.util.concurrent.CompletableFuture<java.util.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.
      java.lang.String getServiceUrl()
      Returns broker-service lookup api url.
      java.util.concurrent.CompletableFuture<java.util.List<java.lang.String>> getTopicsUnderNamespace​(org.apache.pulsar.common.naming.NamespaceName namespace, org.apache.pulsar.common.api.proto.CommandGetTopicsOfNamespace.Mode mode)
      Returns all the topics name for a given namespace.
      void updateServiceUrl​(java.lang.String serviceUrl)
      Instruct the LookupService to switch to a new service URL for all subsequent requests.
      • Methods inherited from interface java.lang.AutoCloseable

        close
    • Method Detail

      • updateServiceUrl

        void updateServiceUrl​(java.lang.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

        java.util.concurrent.CompletableFuture<org.apache.commons.lang3.tuple.Pair<java.net.InetSocketAddress,​java.net.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

        java.util.concurrent.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

        java.util.concurrent.CompletableFuture<java.util.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

        java.util.concurrent.CompletableFuture<java.util.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

        java.lang.String getServiceUrl()
        Returns broker-service lookup api url.
        Returns:
      • getTopicsUnderNamespace

        java.util.concurrent.CompletableFuture<java.util.List<java.lang.String>> getTopicsUnderNamespace​(org.apache.pulsar.common.naming.NamespaceName namespace,
                                                                                                         org.apache.pulsar.common.api.proto.CommandGetTopicsOfNamespace.Mode mode)
        Returns all the topics name for a given namespace.
        Parameters:
        namespace - : namespace-name
        Returns: