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 class
BinaryProtoLookupService.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 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 SchemaInfoSchemaInfo
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 SchemaInfoSchemaInfo
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
-
-
-
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 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:
getBroker
in 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:
getPartitionedTopicMetadata
in 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:LookupService
Returns current SchemaInfoSchemaInfo
for a given topic.- Specified by:
getSchema
in 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:LookupService
Returns specific version SchemaInfoSchemaInfo
for a given topic.- Specified by:
getSchema
in interfaceLookupService
- Parameters:
topicName
- topic-nameversion
- 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 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:LookupService
Returns all the topics name for a given namespace.- Specified by:
getTopicsUnderNamespace
in interfaceLookupService
- Parameters:
namespace
- : namespace-name- Returns:
-
close
public void close() throws java.lang.Exception
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Throws:
java.lang.Exception
-
-