Package org.apache.pulsar.common.topics
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 ClassesModifier and TypeInterfaceDescriptionstatic enumThe regex implementation type used by the TopicsPattern. -
Method Summary
Modifier and TypeMethodDescriptionReturns the original regex pattern used by this TopicsPattern passed as input.booleanEvaluates the pattern for the given topic name which is expected to be passed without the domain scheme prefix in the format "tenant/namespace/topic".default NamespaceNameReturns the namespace associated with this TopicsPattern.default StringThe Topic watcher instance will be created on the broker based on a lookup for the topic name returned by this method.
-
Method Details
-
matches
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
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
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
-