Package org.apache.pulsar.client.impl
Interface LookupService
-
- All Superinterfaces:
java.lang.AutoCloseable
- All Known Implementing Classes:
BinaryProtoLookupService,HttpLookupService
public interface LookupService extends java.lang.AutoCloseableProvides 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 brokerInetSocketAddresswhich 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)ReturnsPartitionedTopicMetadatafor 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 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.
-
-
-
Method Detail
-
updateServiceUrl
void updateServiceUrl(java.lang.String serviceUrl) throws org.apache.pulsar.client.api.PulsarClientExceptionInstruct 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 brokerInetSocketAddresswhich 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)
ReturnsPartitionedTopicMetadatafor 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 SchemaInfoSchemaInfofor 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 SchemaInfoSchemaInfofor a given topic.- Parameters:
topicName- topic-nameversion- 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:
-
-