Package org.apache.pulsar.common.topics
Class TopicsPatternFactory
java.lang.Object
org.apache.pulsar.common.topics.TopicsPatternFactory
Factory class for creating instances of TopicsPattern based on different regex implementations.
It supports JDK regex, RE2J regex, and a fallback mechanism for RE2J with JDK.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic TopicsPatterncreate(String regex, TopicsPattern.RegexImplementation implementation) Creates a TopicsPattern from a regex string, using the specified regex implementation.static TopicsPatternCreates a TopicsPattern from a JDK Pattern.static TopicsPatternmatchAll()Creates a TopicsPattern that matches all topics.
-
Constructor Details
-
TopicsPatternFactory
public TopicsPatternFactory()
-
-
Method Details
-
create
Creates a TopicsPattern from a JDK Pattern. If the pattern contains the topic domain scheme, it will be removed and a RE2J_WITH_JDK_FALLBACK implementation will be used. If the pattern does not contain the topic domain scheme, the input JDK Pattern instance will be used to evaluate topic name matches. The Pulsar Java Client will use this method to create a TopicsPattern from a JDK Pattern.- Parameters:
jdkPattern- the JDK Pattern to create the TopicsPattern from- Returns:
- a TopicsPattern instance
-
create
Creates a TopicsPattern from a regex string, using the specified regex implementation. The Pulsar Broker will use this method to create a TopicsPattern from a regex string. The implementation is configured in the broker configuration file with the `topicsPatternRegexImplementation` property.- Parameters:
regex- the regex string to create the TopicsPattern fromimplementation- the regex implementation to use (RE2J, JDK, or RE2J_WITH_JDK_FALLBACK)- Returns:
- a TopicsPattern instance
-
matchAll
Creates a TopicsPattern that matches all topics.- Returns:
- a TopicsPattern instance that matches all topics
-