Interface TopicsPattern


public interface TopicsPattern
Interface for matching topic names against a pattern. Implementations can use different regex libraries such as RE2J or standard JDK. There's also an option to use RE2J with JDK fallback.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    The regex implementation type used by the TopicsPattern.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the original regex pattern used by this TopicsPattern passed as input.
    boolean
    matches(String topicNameWithoutDomainSchemePrefix)
    Evaluates the pattern for the given topic name which is expected to be passed without the domain scheme prefix in the format "tenant/namespace/topic".
    Returns the namespace associated with this TopicsPattern.
    default String
    The Topic watcher instance will be created on the broker based on a lookup for the topic name returned by this method.
  • Method Details

    • matches

      boolean matches(String topicNameWithoutDomainSchemePrefix)
      Evaluates the pattern for the given topic name which is expected to be passed without the domain scheme prefix in the format "tenant/namespace/topic".
      Parameters:
      topicNameWithoutDomainSchemePrefix - the topic name to match
      Returns:
      true if the topic matches the pattern, false otherwise
    • inputPattern

      String inputPattern()
      Returns the original regex pattern used by this TopicsPattern passed as input. The internal implementation modifies the pattern to remove the possible topic domain scheme (e.g., "persistent://") since in matching the topic name, the domain scheme is ignored.
      Returns:
      the regex pattern as a string
    • namespace

      default NamespaceName namespace()
      Returns the namespace associated with this TopicsPattern. This is typically used to determine the namespace context for the pattern.
      Returns:
      the NamespaceName associated with this TopicsPattern
    • topicLookupNameForTopicListWatcherPlacement

      default String topicLookupNameForTopicListWatcherPlacement()
      The Topic watcher instance will be created on the broker based on a lookup for the topic name returned by this method. The placement reuses topic lookup so that the Pulsar load balancer can place the topic watcher on different brokers based on load without having to implement another load balancing solution for topic watchers.
      Returns:
      the topic lookup name for topic watcher placement