Package org.apache.pulsar.broker.lookup
Class TopicLookupBase
- java.lang.Object
-
- org.apache.pulsar.broker.web.PulsarWebResource
-
- org.apache.pulsar.broker.lookup.TopicLookupBase
-
- Direct Known Subclasses:
TopicLookup,TopicLookup
public class TopicLookupBase extends PulsarWebResource
-
-
Field Summary
-
Fields inherited from class org.apache.pulsar.broker.web.PulsarWebResource
httpRequest, NOT_IMPLEMENTED, servletContext, uri
-
-
Constructor Summary
Constructors Constructor Description TopicLookupBase()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.pulsar.common.naming.TopicNamegetTopicName(java.lang.String topicDomain, java.lang.String tenant, java.lang.String namespace, java.lang.String encodedTopic)protected org.apache.pulsar.common.naming.TopicNamegetTopicName(java.lang.String topicDomain, java.lang.String tenant, java.lang.String cluster, java.lang.String namespace, java.lang.String encodedTopic)protected java.lang.StringinternalGetNamespaceBundle(org.apache.pulsar.common.naming.TopicName topicName)protected voidinternalLookupTopicAsync(org.apache.pulsar.common.naming.TopicName topicName, boolean authoritative, javax.ws.rs.container.AsyncResponse asyncResponse, java.lang.String listenerName)static java.util.concurrent.CompletableFuture<io.netty.buffer.ByteBuf>lookupTopicAsync(PulsarService pulsarService, org.apache.pulsar.common.naming.TopicName topicName, boolean authoritative, java.lang.String clientAppId, org.apache.pulsar.broker.authentication.AuthenticationDataSource authenticationData, long requestId)Lookup broker-service address for a given namespace-bundle which contains given topic.static java.util.concurrent.CompletableFuture<io.netty.buffer.ByteBuf>lookupTopicAsync(PulsarService pulsarService, org.apache.pulsar.common.naming.TopicName topicName, boolean authoritative, java.lang.String clientAppId, org.apache.pulsar.broker.authentication.AuthenticationDataSource authenticationData, long requestId, java.lang.String advertisedListenerName)Lookup broker-service address for a given namespace-bundle which contains given topic.-
Methods inherited from class org.apache.pulsar.broker.web.PulsarWebResource
bookieResources, canUpdateCluster, checkAuthorizationAsync, checkLocalOrGetPeerReplicationCluster, checkLocalOrGetPeerReplicationCluster, clientAppId, clientAuthData, clusterResources, config, dynamicConfigurationResources, getClusterDataIfDifferentCluster, getLocalPolicies, getPulsarResources, handleCommonRestAsyncException, hasActiveNamespace, hasSuperUserAccess, isBundleOwnedByAnyBroker, isClientAuthenticated, isLeaderBroker, isLeaderBroker, isRequestHttps, jsonMapper, namespaceIsolationPolicies, namespaceResources, originalPrincipal, pulsar, resourceGroupResources, setPulsar, splitPath, tenantResources, topicResources, validateAdminAccessForTenant, validateAdminAccessForTenant, validateAdminAccessForTenantAsync, validateBrokerName, validateBundleOwnership, validateBundleOwnership, validateClusterExists, validateClusterForTenant, validateClusterOwnership, validateGlobalNamespaceOwnership, validateGlobalNamespaceOwnershipAsync, validateNamespaceBundleOwnership, validateNamespaceBundleRange, validateNamespaceOperation, validateNamespaceOperationAsync, validateNamespacePolicyOperation, validatePoliciesReadOnlyAccess, validateSuperUserAccess, validateTenantOperation, validateTopicOperation, validateTopicOperation, validateTopicOperationAsync, validateTopicOperationAsync, validateTopicOwnership, validateTopicOwnershipAsync, validateTopicPolicyOperation
-
-
-
-
Method Detail
-
internalLookupTopicAsync
protected void internalLookupTopicAsync(org.apache.pulsar.common.naming.TopicName topicName, boolean authoritative, javax.ws.rs.container.AsyncResponse asyncResponse, java.lang.String listenerName)
-
internalGetNamespaceBundle
protected java.lang.String internalGetNamespaceBundle(org.apache.pulsar.common.naming.TopicName topicName)
-
lookupTopicAsync
public static java.util.concurrent.CompletableFuture<io.netty.buffer.ByteBuf> lookupTopicAsync(PulsarService pulsarService, org.apache.pulsar.common.naming.TopicName topicName, boolean authoritative, java.lang.String clientAppId, org.apache.pulsar.broker.authentication.AuthenticationDataSource authenticationData, long requestId)
Lookup broker-service address for a given namespace-bundle which contains given topic. a. Returns broker-address if namespace-bundle is already owned by any broker b. If current-broker receives lookup-request and if it's not a leader then current broker redirects request to leader by returning leader-service address. c. If current-broker is leader then it finds out least-loaded broker to own namespace bundle and redirects request by returning least-loaded broker. d. If current-broker receives request to own the namespace-bundle then it owns a bundle and returns success(connect) response to client.- Parameters:
pulsarService-topicName-authoritative-clientAppId-requestId-- Returns:
-
lookupTopicAsync
public static java.util.concurrent.CompletableFuture<io.netty.buffer.ByteBuf> lookupTopicAsync(PulsarService pulsarService, org.apache.pulsar.common.naming.TopicName topicName, boolean authoritative, java.lang.String clientAppId, org.apache.pulsar.broker.authentication.AuthenticationDataSource authenticationData, long requestId, java.lang.String advertisedListenerName)
Lookup broker-service address for a given namespace-bundle which contains given topic. a. Returns broker-address if namespace-bundle is already owned by any broker b. If current-broker receives lookup-request and if it's not a leader then current broker redirects request to leader by returning leader-service address. c. If current-broker is leader then it finds out least-loaded broker to own namespace bundle and redirects request by returning least-loaded broker. d. If current-broker receives request to own the namespace-bundle then it owns a bundle and returns success(connect) response to client.- Parameters:
pulsarService-topicName-authoritative-clientAppId-requestId-advertisedListenerName-- Returns:
-
getTopicName
protected org.apache.pulsar.common.naming.TopicName getTopicName(java.lang.String topicDomain, java.lang.String tenant, java.lang.String cluster, java.lang.String namespace, @Encoded java.lang.String encodedTopic)
-
getTopicName
protected org.apache.pulsar.common.naming.TopicName getTopicName(java.lang.String topicDomain, java.lang.String tenant, java.lang.String namespace, @Encoded java.lang.String encodedTopic)
-
-