Package org.apache.pulsar.broker.admin
Class AdminResource
java.lang.Object
org.apache.pulsar.broker.web.PulsarWebResource
org.apache.pulsar.broker.admin.AdminResource
- Direct Known Subclasses:
Bookies,BrokersBase,BrokerStatsBase,ClustersBase,Functions,FunctionsBase,NamespacesBase,PackagesBase,PersistentTopicsBase,ResourceGroupsBase,SchemasResourceBase,SinksBase,SourcesBase,TransactionsBase,Worker,WorkerStats
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.pulsar.common.naming.NamespaceNameprotected org.apache.pulsar.common.naming.TopicNameFields inherited from class org.apache.pulsar.broker.web.PulsarWebResource
httpRequest, servletContext, uri -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.bookkeeper.client.BookKeeperprotected voidcheckArgument(boolean b, String errorMessage) protected booleancheckBacklogQuota(org.apache.pulsar.common.policies.data.BacklogQuota quota, org.apache.pulsar.common.policies.data.RetentionPolicies retention) protected voidcheckNotNull(Object o, String errorMessage) static <T> TcheckNotNull(T reference) protected CompletableFuture<Boolean>checkTopicExistsAsync(org.apache.pulsar.common.naming.TopicName topicName) Check the exists topics contains the given topic.protected voidclusters()protected CompletableFuture<Set<String>>protected org.apache.pulsar.common.policies.data.impl.DispatchRateImplprotected Stringdomain()Get the domain of the topic (whether it's persistent or non-persistent).protected static org.apache.pulsar.common.partition.PartitionedTopicMetadatafetchPartitionedTopicMetadata(PulsarService pulsar, org.apache.pulsar.common.naming.TopicName topicName) protected static org.apache.pulsar.common.partition.PartitionedTopicMetadatafetchPartitionedTopicMetadataCheckAllowAutoCreation(PulsarService pulsar, org.apache.pulsar.common.naming.TopicName topicName) filterSystemTopic(List<String> topics, boolean includeSystemTopic) protected org.apache.pulsar.common.policies.data.PoliciesgetNamespacePolicies(String tenant, String cluster, String namespace) protected org.apache.pulsar.common.policies.data.PoliciesgetNamespacePolicies(org.apache.pulsar.common.naming.NamespaceName namespaceName) protected CompletableFuture<org.apache.pulsar.common.policies.data.Policies>getNamespacePoliciesAsync(org.apache.pulsar.common.naming.NamespaceName namespaceName) getNamespaceReplicatedClusters(org.apache.pulsar.common.naming.NamespaceName namespaceName) protected CompletableFuture<Set<String>>getNamespaceReplicatedClustersAsync(org.apache.pulsar.common.naming.NamespaceName namespaceName) getPartitionedTopicList(org.apache.pulsar.common.naming.TopicDomain topicDomain) protected CompletableFuture<List<String>>getPartitionedTopicListAsync(org.apache.pulsar.common.naming.TopicDomain topicDomain) protected org.apache.pulsar.common.partition.PartitionedTopicMetadatagetPartitionedTopicMetadata(org.apache.pulsar.common.naming.TopicName topicName, boolean authoritative, boolean checkAllowAutoCreation) protected CompletableFuture<org.apache.pulsar.common.partition.PartitionedTopicMetadata>getPartitionedTopicMetadataAsync(org.apache.pulsar.common.naming.TopicName topicName, boolean authoritative, boolean checkAllowAutoCreation) protected static Stringprotected CompletableFuture<org.apache.pulsar.common.policies.data.SchemaCompatibilityStrategy>protected CompletableFuture<org.apache.pulsar.common.policies.data.SchemaCompatibilityStrategy>protected static StringgetSubNotFoundErrorMessage(String topic, String subscription) protected static StringgetTopicPartitionList(org.apache.pulsar.common.naming.TopicDomain topicDomain) protected CompletableFuture<Optional<org.apache.pulsar.common.policies.data.TopicPolicies>>getTopicPoliciesAsyncWithRetry(org.apache.pulsar.common.naming.TopicName topicName) protected CompletableFuture<Optional<org.apache.pulsar.common.policies.data.TopicPolicies>>getTopicPoliciesAsyncWithRetry(org.apache.pulsar.common.naming.TopicName topicName, boolean isGlobal) protected voidinternalCreatePartitionedTopic(javax.ws.rs.container.AsyncResponse asyncResponse, int numPartitions, boolean createLocalTopicOnly) protected voidinternalCreatePartitionedTopic(javax.ws.rs.container.AsyncResponse asyncResponse, int numPartitions, boolean createLocalTopicOnly, Map<String, String> properties) protected booleanprotected booleanprotected booleanisNamespaceReplicated(org.apache.pulsar.common.naming.NamespaceName namespaceName) protected static booleanprotected static booleanCheck current exception whether is redirect exception.static com.fasterxml.jackson.databind.ObjectMapperprotected org.apache.pulsar.common.policies.data.BacklogQuotanamespaceBacklogQuota(org.apache.pulsar.common.naming.NamespaceName namespace, org.apache.pulsar.common.policies.data.BacklogQuota.BacklogQuotaType backlogQuotaType) protected org.apache.pulsar.common.policies.data.impl.DispatchRateImplprotected voidsetServletContext(javax.servlet.ServletContext servletContext) protected org.apache.pulsar.common.policies.data.SubscribeRateprotected org.apache.pulsar.common.policies.data.impl.DispatchRateImplprotected CompletableFuture<Void>tryCreateExtendedPartitionsAsync(int oldNumPartitions, int numPartitions) protected CompletableFuture<Void>tryCreatePartitionsAsync(int numPartitions) protected voidvalidateAdminAccessForTenant(String property) Checks that the http client role has admin access to the specified tenant.protected org.apache.pulsar.functions.worker.WorkerServiceprotected voidvalidateBundleOwnership(String property, String cluster, String namespace, boolean authoritative, boolean readOnly, NamespaceBundle bundle) protected voidvalidateClusterExists(String cluster) protected voidprotected voidvalidateNamespaceName(String property, String namespace) protected voidvalidateNamespaceName(String property, String cluster, String namespace) Deprecated.protected CompletableFuture<Void>protected voidvalidatePartitionedTopicName(String tenant, String namespace, String encodedTopic) protected voidvalidatePersistencePolicies(org.apache.pulsar.common.policies.data.PersistencePolicies persistence) protected voidvalidatePersistentTopicName(String property, String namespace, String encodedTopic) protected voidvalidatePersistentTopicName(String property, String cluster, String namespace, String encodedTopic) Deprecated.voidChecks whether the broker is allowed to do read-write operations based on the existence of a node in configuration metadata-store.voidChecks whether the user has Pulsar Super-User access to the system.protected voidvalidateTopicName(String property, String namespace, String encodedTopic) protected voidvalidateTopicName(String property, String cluster, String namespace, String encodedTopic) Deprecated.Methods inherited from class org.apache.pulsar.broker.web.PulsarWebResource
bookieResources, canUpdateCluster, checkAuthorizationAsync, checkLocalOrGetPeerReplicationCluster, checkLocalOrGetPeerReplicationCluster, clientAppId, clientAuthData, clusterResources, config, dynamicConfigurationResources, getClusterDataIfDifferentCluster, getLocalPolicies, getPulsarResources, hasActiveNamespace, hasSuperUserAccess, isBundleOwnedByAnyBroker, isClientAuthenticated, isLeaderBroker, isRequestHttps, namespaceIsolationPolicies, namespaceResources, originalPrincipal, pulsar, resourceGroupResources, resumeAsyncResponseExceptionally, setPulsar, splitPath, sync, tenantResources, topicResources, validateAdminAccessForTenant, validateAdminAccessForTenantAsync, validateAdminAccessForTenantAsync, validateBrokerName, validateBundleOwnership, validateBundleOwnershipAsync, validateClusterForTenant, validateClusterForTenantAsync, validateClusterOwnership, validateClusterOwnershipAsync, validateGlobalNamespaceOwnership, validateGlobalNamespaceOwnershipAsync, validateNamespaceBundleOwnership, validateNamespaceBundleOwnershipAsync, validateNamespaceBundleRange, validateNamespaceOperation, validateNamespaceOperationAsync, validateNamespacePolicyOperation, validateNamespacePolicyOperationAsync, validatePeerClusterConflict, validatePeerClusterConflictAsync, validateSuperUserAccessAsync, validateTenantOperation, validateTenantOperationAsync, validateTopicOperation, validateTopicOperation, validateTopicOperationAsync, validateTopicOperationAsync, validateTopicOwnership, validateTopicOwnershipAsync, validateTopicPolicyOperation, validateTopicPolicyOperationAsync
-
Field Details
-
namespaceName
protected org.apache.pulsar.common.naming.NamespaceName namespaceName -
topicName
protected org.apache.pulsar.common.naming.TopicName topicName
-
-
Constructor Details
-
AdminResource
public AdminResource()
-
-
Method Details
-
bookKeeper
protected org.apache.bookkeeper.client.BookKeeper bookKeeper() -
domain
Get the domain of the topic (whether it's persistent or non-persistent). -
validateSuperUserAccess
public void validateSuperUserAccess()Description copied from class:PulsarWebResourceChecks whether the user has Pulsar Super-User access to the system.- Overrides:
validateSuperUserAccessin classPulsarWebResource
-
validateAdminAccessForTenant
Description copied from class:PulsarWebResourceChecks that the http client role has admin access to the specified tenant.- Overrides:
validateAdminAccessForTenantin classPulsarWebResource- Parameters:
property- the tenant id
-
validateBundleOwnership
protected void validateBundleOwnership(String property, String cluster, String namespace, boolean authoritative, boolean readOnly, NamespaceBundle bundle) - Overrides:
validateBundleOwnershipin classPulsarWebResource
-
isLeaderBroker
protected boolean isLeaderBroker()- Overrides:
isLeaderBrokerin classPulsarWebResource
-
validatePoliciesReadOnlyAccess
public void validatePoliciesReadOnlyAccess()Checks whether the broker is allowed to do read-write operations based on the existence of a node in configuration metadata-store.- Overrides:
validatePoliciesReadOnlyAccessin classPulsarWebResource- Throws:
javax.ws.rs.WebApplicationException- if broker has a read only access if broker is not connected to the configuration metadata-store
-
validatePoliciesReadOnlyAccessAsync
- Overrides:
validatePoliciesReadOnlyAccessAsyncin classPulsarWebResource
-
tryCreatePartitionsAsync
-
tryCreateExtendedPartitionsAsync
protected CompletableFuture<Void> tryCreateExtendedPartitionsAsync(int oldNumPartitions, int numPartitions) -
validateNamespaceName
-
validateGlobalNamespaceOwnership
protected void validateGlobalNamespaceOwnership() -
validateNamespaceName
Deprecated. -
validateTopicName
-
validatePersistentTopicName
-
validatePartitionedTopicName
-
validatePartitionedTopicMetadataAsync
-
validateTopicName
@Deprecated protected void validateTopicName(String property, String cluster, String namespace, String encodedTopic) Deprecated. -
validatePersistentTopicName
@Deprecated protected void validatePersistentTopicName(String property, String cluster, String namespace, String encodedTopic) Deprecated. -
validateAndGetWorkerService
protected org.apache.pulsar.functions.worker.WorkerService validateAndGetWorkerService() -
getNamespacePolicies
protected org.apache.pulsar.common.policies.data.Policies getNamespacePolicies(org.apache.pulsar.common.naming.NamespaceName namespaceName) -
getNamespacePoliciesAsync
protected CompletableFuture<org.apache.pulsar.common.policies.data.Policies> getNamespacePoliciesAsync(org.apache.pulsar.common.naming.NamespaceName namespaceName) -
namespaceBacklogQuota
protected org.apache.pulsar.common.policies.data.BacklogQuota namespaceBacklogQuota(org.apache.pulsar.common.naming.NamespaceName namespace, org.apache.pulsar.common.policies.data.BacklogQuota.BacklogQuotaType backlogQuotaType) -
getTopicPoliciesAsyncWithRetry
protected CompletableFuture<Optional<org.apache.pulsar.common.policies.data.TopicPolicies>> getTopicPoliciesAsyncWithRetry(org.apache.pulsar.common.naming.TopicName topicName) -
getTopicPoliciesAsyncWithRetry
protected CompletableFuture<Optional<org.apache.pulsar.common.policies.data.TopicPolicies>> getTopicPoliciesAsyncWithRetry(org.apache.pulsar.common.naming.TopicName topicName, boolean isGlobal) -
checkBacklogQuota
protected boolean checkBacklogQuota(org.apache.pulsar.common.policies.data.BacklogQuota quota, org.apache.pulsar.common.policies.data.RetentionPolicies retention) -
checkTopicLevelPolicyEnable
protected void checkTopicLevelPolicyEnable() -
dispatchRate
protected org.apache.pulsar.common.policies.data.impl.DispatchRateImpl dispatchRate() -
subscriptionDispatchRate
protected org.apache.pulsar.common.policies.data.impl.DispatchRateImpl subscriptionDispatchRate() -
replicatorDispatchRate
protected org.apache.pulsar.common.policies.data.impl.DispatchRateImpl replicatorDispatchRate() -
subscribeRate
protected org.apache.pulsar.common.policies.data.SubscribeRate subscribeRate() -
jsonMapper
public static com.fasterxml.jackson.databind.ObjectMapper jsonMapper() -
clusters
-
clustersAsync
-
setServletContext
protected void setServletContext(javax.servlet.ServletContext servletContext) -
getPartitionedTopicMetadata
protected org.apache.pulsar.common.partition.PartitionedTopicMetadata getPartitionedTopicMetadata(org.apache.pulsar.common.naming.TopicName topicName, boolean authoritative, boolean checkAllowAutoCreation) -
getPartitionedTopicMetadataAsync
protected CompletableFuture<org.apache.pulsar.common.partition.PartitionedTopicMetadata> getPartitionedTopicMetadataAsync(org.apache.pulsar.common.naming.TopicName topicName, boolean authoritative, boolean checkAllowAutoCreation) -
fetchPartitionedTopicMetadata
protected static org.apache.pulsar.common.partition.PartitionedTopicMetadata fetchPartitionedTopicMetadata(PulsarService pulsar, org.apache.pulsar.common.naming.TopicName topicName) -
fetchPartitionedTopicMetadataCheckAllowAutoCreation
protected static org.apache.pulsar.common.partition.PartitionedTopicMetadata fetchPartitionedTopicMetadataCheckAllowAutoCreation(PulsarService pulsar, org.apache.pulsar.common.naming.TopicName topicName) -
validateClusterExists
- Overrides:
validateClusterExistsin classPulsarWebResource
-
getNamespacePolicies
-
isNamespaceReplicated
protected boolean isNamespaceReplicated(org.apache.pulsar.common.naming.NamespaceName namespaceName) -
getNamespaceReplicatedClusters
-
getNamespaceReplicatedClustersAsync
protected CompletableFuture<Set<String>> getNamespaceReplicatedClustersAsync(org.apache.pulsar.common.naming.NamespaceName namespaceName) -
getPartitionedTopicList
-
getPartitionedTopicListAsync
protected CompletableFuture<List<String>> getPartitionedTopicListAsync(org.apache.pulsar.common.naming.TopicDomain topicDomain) -
getTopicPartitionList
-
internalCreatePartitionedTopic
protected void internalCreatePartitionedTopic(javax.ws.rs.container.AsyncResponse asyncResponse, int numPartitions, boolean createLocalTopicOnly) -
internalCreatePartitionedTopic
-
checkTopicExistsAsync
protected CompletableFuture<Boolean> checkTopicExistsAsync(org.apache.pulsar.common.naming.TopicName topicName) Check the exists topics contains the given topic. Since there are topic partitions and non-partitioned topics in Pulsar, must ensure both partitions and non-partitioned topics are not duplicated. So, if compare with a partition name, we should compare to the partitioned name of this partition.- Parameters:
topicName- given topic name
-
getSchemaCompatibilityStrategyAsync
protected CompletableFuture<org.apache.pulsar.common.policies.data.SchemaCompatibilityStrategy> getSchemaCompatibilityStrategyAsync() -
getSchemaCompatibilityStrategyAsyncWithoutAuth
protected CompletableFuture<org.apache.pulsar.common.policies.data.SchemaCompatibilityStrategy> getSchemaCompatibilityStrategyAsyncWithoutAuth() -
checkNotNull
@CanIgnoreReturnValue public static <T> T checkNotNull(T reference) -
checkNotNull
-
isManagedLedgerNotFoundException
-
checkArgument
-
validatePersistencePolicies
protected void validatePersistencePolicies(org.apache.pulsar.common.policies.data.PersistencePolicies persistence) -
isRedirectException
Check current exception whether is redirect exception.- Parameters:
ex- The throwable.- Returns:
- Whether is redirect exception
-
isNotFoundException
-
getTopicNotFoundErrorMessage
-
getPartitionedTopicNotFoundErrorMessage
-
getSubNotFoundErrorMessage
-
filterSystemTopic
-