Class BinaryProtoLookupService

  • All Implemented Interfaces:
    java.lang.AutoCloseable, LookupService

    public class BinaryProtoLookupService
    extends java.lang.Object
    implements LookupService
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      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 binaryProto-lookup api to find broker-service address which can serve a given topic.
      java.util.concurrent.CompletableFuture<org.apache.pulsar.common.partition.PartitionedTopicMetadata> getPartitionedTopicMetadata​(org.apache.pulsar.common.naming.TopicName topicName)
      calls broker binaryProto-lookup api to get metadata of partitioned-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 class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BinaryProtoLookupService

        public BinaryProtoLookupService​(PulsarClientImpl client,
                                        java.lang.String serviceUrl,
                                        boolean useTls,
                                        java.util.concurrent.ExecutorService executor)
                                 throws org.apache.pulsar.client.api.PulsarClientException
        Throws:
        org.apache.pulsar.client.api.PulsarClientException
      • BinaryProtoLookupService

        public BinaryProtoLookupService​(PulsarClientImpl client,
                                        java.lang.String serviceUrl,
                                        java.lang.String listenerName,
                                        boolean useTls,
                                        java.util.concurrent.ExecutorService executor)
                                 throws org.apache.pulsar.client.api.PulsarClientException
        Throws:
        org.apache.pulsar.client.api.PulsarClientException
    • Method Detail

      • updateServiceUrl

        public void updateServiceUrl​(java.lang.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 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 binaryProto-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 java.util.concurrent.CompletableFuture<org.apache.pulsar.common.partition.PartitionedTopicMetadata> getPartitionedTopicMetadata​(org.apache.pulsar.common.naming.TopicName topicName)
        calls broker binaryProto-lookup api to get metadata of partitioned-topic.
        Specified by:
        getPartitionedTopicMetadata in interface LookupService
        Parameters:
        topicName - topic-name
        Returns:
      • getSchema

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

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

        public 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)
        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:
      • close

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