Package org.apache.pulsar.client.impl
Class BinaryProtoLookupService
- java.lang.Object
-
- org.apache.pulsar.client.impl.BinaryProtoLookupService
-
- All Implemented Interfaces:
java.lang.AutoCloseable,LookupService
public class BinaryProtoLookupService extends java.lang.Object implements LookupService
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBinaryProtoLookupService.LookupDataResult
-
Constructor Summary
Constructors Constructor Description BinaryProtoLookupService(PulsarClientImpl client, java.lang.String serviceUrl, boolean useTls, java.util.concurrent.ExecutorService executor)BinaryProtoLookupService(PulsarClientImpl client, java.lang.String serviceUrl, java.lang.String listenerName, boolean useTls, java.util.concurrent.ExecutorService executor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()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 SchemaInfoSchemaInfofor 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 SchemaInfoSchemaInfofor a given topic.java.lang.StringgetServiceUrl()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.voidupdateServiceUrl(java.lang.String serviceUrl)Instruct the LookupService to switch to a new service URL for all subsequent requests.
-
-
-
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.PulsarClientExceptionDescription copied from interface:LookupServiceInstruct the LookupService to switch to a new service URL for all subsequent requests.- Specified by:
updateServiceUrlin interfaceLookupService- 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:
getBrokerin interfaceLookupService- 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:
getPartitionedTopicMetadatain interfaceLookupService- 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:LookupServiceReturns current SchemaInfoSchemaInfofor a given topic.- Specified by:
getSchemain interfaceLookupService- 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:LookupServiceReturns specific version SchemaInfoSchemaInfofor a given topic.- Specified by:
getSchemain interfaceLookupService- Parameters:
topicName- topic-nameversion- schema info version- Returns:
- SchemaInfo
-
getServiceUrl
public java.lang.String getServiceUrl()
Description copied from interface:LookupServiceReturns broker-service lookup api url.- Specified by:
getServiceUrlin interfaceLookupService- 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:LookupServiceReturns all the topics name for a given namespace.- Specified by:
getTopicsUnderNamespacein interfaceLookupService- Parameters:
namespace- : namespace-name- Returns:
-
close
public void close() throws java.lang.Exception- Specified by:
closein interfacejava.lang.AutoCloseable- Throws:
java.lang.Exception
-
-