Package org.apache.pulsar.client.impl
Class HttpLookupService
java.lang.Object
org.apache.pulsar.client.impl.HttpLookupService
- All Implemented Interfaces:
AutoCloseable
,LookupService
-
Constructor Summary
ConstructorsConstructorDescriptionHttpLookupService
(ClientConfigurationData conf, io.netty.channel.EventLoopGroup eventLoopGroup) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
CompletableFuture<org.apache.commons.lang3.tuple.Pair<InetSocketAddress,
InetSocketAddress>> getBroker
(org.apache.pulsar.common.naming.TopicName topicName) Calls http-lookup api to find broker-service address which can serve a given topic.CompletableFuture<org.apache.pulsar.common.partition.PartitionedTopicMetadata>
getPartitionedTopicMetadata
(org.apache.pulsar.common.naming.TopicName topicName) ReturnsPartitionedTopicMetadata
for a given topic.CompletableFuture<Optional<org.apache.pulsar.common.schema.SchemaInfo>>
getSchema
(org.apache.pulsar.common.naming.TopicName topicName) Returns current SchemaInfoSchemaInfo
for a given topic.CompletableFuture<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.Returns broker-service lookup api url.CompletableFuture<org.apache.pulsar.common.lookup.GetTopicsResult>
getTopicsUnderNamespace
(org.apache.pulsar.common.naming.NamespaceName namespace, org.apache.pulsar.common.api.proto.CommandGetTopicsOfNamespace.Mode mode, String topicsPattern, String topicsHash) Returns all the topics name for a given namespace.Resolves pulsar service url.void
updateServiceUrl
(String serviceUrl) Instruct the LookupService to switch to a new service URL for all subsequent requests.
-
Constructor Details
-
HttpLookupService
public HttpLookupService(ClientConfigurationData conf, io.netty.channel.EventLoopGroup eventLoopGroup) throws org.apache.pulsar.client.api.PulsarClientException - Throws:
org.apache.pulsar.client.api.PulsarClientException
-
-
Method Details
-
updateServiceUrl
public void updateServiceUrl(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 CompletableFuture<org.apache.commons.lang3.tuple.Pair<InetSocketAddress,InetSocketAddress>> getBroker(org.apache.pulsar.common.naming.TopicName topicName) Calls http-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 CompletableFuture<org.apache.pulsar.common.partition.PartitionedTopicMetadata> getPartitionedTopicMetadata(org.apache.pulsar.common.naming.TopicName topicName) Description copied from interface:LookupService
ReturnsPartitionedTopicMetadata
for a given topic.- Specified by:
getPartitionedTopicMetadata
in interfaceLookupService
- Parameters:
topicName
- topic-name- Returns:
-
getServiceUrl
Description copied from interface:LookupService
Returns broker-service lookup api url.- Specified by:
getServiceUrl
in interfaceLookupService
- Returns:
-
resolveHost
Description copied from interface:LookupService
Resolves pulsar service url.- Specified by:
resolveHost
in interfaceLookupService
- Returns:
- the service url resolved to a socket address
-
getTopicsUnderNamespace
public CompletableFuture<org.apache.pulsar.common.lookup.GetTopicsResult> getTopicsUnderNamespace(org.apache.pulsar.common.naming.NamespaceName namespace, org.apache.pulsar.common.api.proto.CommandGetTopicsOfNamespace.Mode mode, String topicsPattern, String topicsHash) Description copied from interface:LookupService
Returns all the topics name for a given namespace.- Specified by:
getTopicsUnderNamespace
in interfaceLookupService
- Parameters:
namespace
- : namespace-name- Returns:
-
getSchema
public CompletableFuture<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 CompletableFuture<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
-
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-