Interface TopicPoliciesService

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
SystemTopicBasedTopicPoliciesService, TopicPoliciesService.TopicPoliciesServiceDisabled

@Stable @LimitedPrivate public interface TopicPoliciesService extends AutoCloseable
Topic policies service.
  • Field Details

  • Method Details

    • deleteTopicPoliciesAsync

      CompletableFuture<Void> deleteTopicPoliciesAsync(org.apache.pulsar.common.naming.TopicName topicName)
      Delete policies for a topic asynchronously.
      Parameters:
      topicName - topic name
    • updateTopicPoliciesAsync

      CompletableFuture<Void> updateTopicPoliciesAsync(org.apache.pulsar.common.naming.TopicName topicName, org.apache.pulsar.common.policies.data.TopicPolicies policies)
      Update policies for a topic asynchronously.
      Parameters:
      topicName - topic name
      policies - policies for the topic name
    • getTopicPoliciesAsync

      CompletableFuture<Optional<org.apache.pulsar.common.policies.data.TopicPolicies>> getTopicPoliciesAsync(org.apache.pulsar.common.naming.TopicName topicName, TopicPoliciesService.GetType type)
      Retrieve the topic policies.
    • start

      default void start(PulsarService pulsar)
      Start the topic policy service.
    • close

      default void close() throws Exception
      Close the resources if necessary.
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception
    • registerListener

      boolean registerListener(org.apache.pulsar.common.naming.TopicName topicName, TopicPolicyListener listener)
      Registers a listener for topic policies updates.

      The listener will receive the latest topic policies when they are updated. If the policies are removed, the listener will receive a null value. Note that not every update is guaranteed to trigger the listener. For instance, if the policies change from A -> B -> null -> C in quick succession, only the final state (C) is guaranteed to be received by the listener. In summary, the listener is guaranteed to receive only the latest value.

      Returns:
      true if the listener is registered successfully
    • unregisterListener

      void unregisterListener(org.apache.pulsar.common.naming.TopicName topicName, TopicPolicyListener listener)
      Unregister the topic policies listener.