Package org.apache.pulsar.broker.service
Class SystemTopicBasedTopicPoliciesService
- java.lang.Object
-
- org.apache.pulsar.broker.service.SystemTopicBasedTopicPoliciesService
-
- All Implemented Interfaces:
TopicPoliciesService
public class SystemTopicBasedTopicPoliciesService extends java.lang.Object implements TopicPoliciesService
Cached topic policies service will cache the system topic reader and the topic policies While reader cache for the namespace was removed, the topic policies will remove automatically.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.pulsar.broker.service.TopicPoliciesService
TopicPoliciesService.TopicPoliciesServiceDisabled
-
-
Field Summary
-
Fields inherited from interface org.apache.pulsar.broker.service.TopicPoliciesService
DEFAULT_GET_TOPIC_POLICY_TIMEOUT, DISABLED
-
-
Constructor Summary
Constructors Constructor Description SystemTopicBasedTopicPoliciesService(PulsarService pulsarService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<java.lang.Void>addOwnedNamespaceBundleAsync(NamespaceBundle namespaceBundle)Add owned namespace bundle async.voidclean(org.apache.pulsar.common.naming.TopicName topicName)clean cache and listeners in TopicPolicies and so on.protected java.util.concurrent.CompletableFuture<SystemTopicClient.Reader<org.apache.pulsar.common.events.PulsarEvent>>createSystemTopicClientWithRetry(org.apache.pulsar.common.naming.NamespaceName namespace)java.util.concurrent.CompletableFuture<java.lang.Void>deleteTopicPoliciesAsync(org.apache.pulsar.common.naming.TopicName topicName)Delete policies for a topic async.protected java.util.Map<org.apache.pulsar.common.naming.TopicName,java.util.List<TopicPolicyListener<org.apache.pulsar.common.policies.data.TopicPolicies>>>getListeners()protected java.util.Map<org.apache.pulsar.common.naming.TopicName,org.apache.pulsar.common.policies.data.TopicPolicies>getPoliciesCache()java.lang.BooleangetPoliciesCacheInit(org.apache.pulsar.common.naming.NamespaceName namespaceName)org.apache.pulsar.common.policies.data.TopicPoliciesgetTopicPolicies(org.apache.pulsar.common.naming.TopicName topicName)Get policies for a topic async.java.util.concurrent.CompletableFuture<org.apache.pulsar.common.policies.data.TopicPolicies>getTopicPoliciesBypassCacheAsync(org.apache.pulsar.common.naming.TopicName topicName)Get policies for a topic without cache async.org.apache.pulsar.common.policies.data.TopicPoliciesgetTopicPoliciesIfExists(org.apache.pulsar.common.naming.TopicName topicName)Get policies from current cache.voidregisterListener(org.apache.pulsar.common.naming.TopicName topicName, TopicPolicyListener<org.apache.pulsar.common.policies.data.TopicPolicies> listener)java.util.concurrent.CompletableFuture<java.lang.Void>removeOwnedNamespaceBundleAsync(NamespaceBundle namespaceBundle)Remove owned namespace bundle async.voidstart()Start the topic policy service.voidunregisterListener(org.apache.pulsar.common.naming.TopicName topicName, TopicPolicyListener<org.apache.pulsar.common.policies.data.TopicPolicies> listener)java.util.concurrent.CompletableFuture<java.lang.Void>updateTopicPoliciesAsync(org.apache.pulsar.common.naming.TopicName topicName, org.apache.pulsar.common.policies.data.TopicPolicies policies)Update policies for a topic async.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.pulsar.broker.service.TopicPoliciesService
getTopicPoliciesAsyncWithRetry
-
-
-
-
Constructor Detail
-
SystemTopicBasedTopicPoliciesService
public SystemTopicBasedTopicPoliciesService(PulsarService pulsarService)
-
-
Method Detail
-
deleteTopicPoliciesAsync
public java.util.concurrent.CompletableFuture<java.lang.Void> deleteTopicPoliciesAsync(org.apache.pulsar.common.naming.TopicName topicName)
Description copied from interface:TopicPoliciesServiceDelete policies for a topic async.- Specified by:
deleteTopicPoliciesAsyncin interfaceTopicPoliciesService- Parameters:
topicName- topic name
-
updateTopicPoliciesAsync
public java.util.concurrent.CompletableFuture<java.lang.Void> updateTopicPoliciesAsync(org.apache.pulsar.common.naming.TopicName topicName, org.apache.pulsar.common.policies.data.TopicPolicies policies)Description copied from interface:TopicPoliciesServiceUpdate policies for a topic async.- Specified by:
updateTopicPoliciesAsyncin interfaceTopicPoliciesService- Parameters:
topicName- topic namepolicies- policies for the topic name
-
getTopicPolicies
public org.apache.pulsar.common.policies.data.TopicPolicies getTopicPolicies(org.apache.pulsar.common.naming.TopicName topicName) throws BrokerServiceException.TopicPoliciesCacheNotInitExceptionDescription copied from interface:TopicPoliciesServiceGet policies for a topic async.- Specified by:
getTopicPoliciesin interfaceTopicPoliciesService- Parameters:
topicName- topic name- Returns:
- future of the topic policies
- Throws:
BrokerServiceException.TopicPoliciesCacheNotInitException
-
getTopicPoliciesIfExists
public org.apache.pulsar.common.policies.data.TopicPolicies getTopicPoliciesIfExists(org.apache.pulsar.common.naming.TopicName topicName)
Description copied from interface:TopicPoliciesServiceGet policies from current cache.- Specified by:
getTopicPoliciesIfExistsin interfaceTopicPoliciesService- Parameters:
topicName- topic name- Returns:
- the topic policies
-
getTopicPoliciesBypassCacheAsync
public java.util.concurrent.CompletableFuture<org.apache.pulsar.common.policies.data.TopicPolicies> getTopicPoliciesBypassCacheAsync(org.apache.pulsar.common.naming.TopicName topicName)
Description copied from interface:TopicPoliciesServiceGet policies for a topic without cache async.- Specified by:
getTopicPoliciesBypassCacheAsyncin interfaceTopicPoliciesService- Parameters:
topicName- topic name- Returns:
- future of the topic policies
-
addOwnedNamespaceBundleAsync
public java.util.concurrent.CompletableFuture<java.lang.Void> addOwnedNamespaceBundleAsync(NamespaceBundle namespaceBundle)
Description copied from interface:TopicPoliciesServiceAdd owned namespace bundle async.- Specified by:
addOwnedNamespaceBundleAsyncin interfaceTopicPoliciesService- Parameters:
namespaceBundle- namespace bundle
-
createSystemTopicClientWithRetry
protected java.util.concurrent.CompletableFuture<SystemTopicClient.Reader<org.apache.pulsar.common.events.PulsarEvent>> createSystemTopicClientWithRetry(org.apache.pulsar.common.naming.NamespaceName namespace)
-
removeOwnedNamespaceBundleAsync
public java.util.concurrent.CompletableFuture<java.lang.Void> removeOwnedNamespaceBundleAsync(NamespaceBundle namespaceBundle)
Description copied from interface:TopicPoliciesServiceRemove owned namespace bundle async.- Specified by:
removeOwnedNamespaceBundleAsyncin interfaceTopicPoliciesService- Parameters:
namespaceBundle- namespace bundle
-
start
public void start()
Description copied from interface:TopicPoliciesServiceStart the topic policy service.- Specified by:
startin interfaceTopicPoliciesService
-
getPoliciesCacheInit
public java.lang.Boolean getPoliciesCacheInit(org.apache.pulsar.common.naming.NamespaceName namespaceName)
-
registerListener
public void registerListener(org.apache.pulsar.common.naming.TopicName topicName, TopicPolicyListener<org.apache.pulsar.common.policies.data.TopicPolicies> listener)- Specified by:
registerListenerin interfaceTopicPoliciesService
-
unregisterListener
public void unregisterListener(org.apache.pulsar.common.naming.TopicName topicName, TopicPolicyListener<org.apache.pulsar.common.policies.data.TopicPolicies> listener)- Specified by:
unregisterListenerin interfaceTopicPoliciesService
-
clean
public void clean(org.apache.pulsar.common.naming.TopicName topicName)
Description copied from interface:TopicPoliciesServiceclean cache and listeners in TopicPolicies and so on.- Specified by:
cleanin interfaceTopicPoliciesService
-
getPoliciesCache
protected java.util.Map<org.apache.pulsar.common.naming.TopicName,org.apache.pulsar.common.policies.data.TopicPolicies> getPoliciesCache()
-
getListeners
protected java.util.Map<org.apache.pulsar.common.naming.TopicName,java.util.List<TopicPolicyListener<org.apache.pulsar.common.policies.data.TopicPolicies>>> getListeners()
-
-