File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
spring-pulsar-reactive/src/main/java/org/springframework/pulsar/reactive/core
spring-pulsar/src/main/java/org/springframework/pulsar/core Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change 1818
1919import java .util .Collections ;
2020import java .util .List ;
21+ import java .util .regex .Pattern ;
2122
23+ import org .apache .commons .lang3 .StringUtils ;
2224import org .apache .pulsar .client .api .Schema ;
2325import org .apache .pulsar .reactive .client .api .ReactiveMessageConsumer ;
2426import org .apache .pulsar .reactive .client .api .ReactiveMessageConsumerBuilder ;
@@ -98,6 +100,12 @@ protected void ensureTopicNamesFullyQualified(ReactiveMessageConsumerBuilder<T>
98100 var fullyQualifiedTopics = topics .stream ().map (this .topicBuilder ::getFullyQualifiedNameForTopic ).toList ();
99101 mutableSpec .setTopicNames (fullyQualifiedTopics );
100102 }
103+ var topicsPattern = mutableSpec .getTopicsPattern ();
104+ if (topicsPattern != null && StringUtils .isNoneBlank (topicsPattern .pattern ())) {
105+ var topicsPatternStr = topicsPattern .pattern ();
106+ var fullyQualifiedTopicsPatternStr = this .topicBuilder .getFullyQualifiedNameForTopic (topicsPatternStr );
107+ mutableSpec .setTopicsPattern (Pattern .compile (fullyQualifiedTopicsPatternStr ));
108+ }
101109 }
102110
103111}
Original file line number Diff line number Diff line change 2323import java .util .Map ;
2424import java .util .Objects ;
2525import java .util .TreeMap ;
26+ import java .util .regex .Pattern ;
2627
28+ import org .apache .commons .lang3 .StringUtils ;
2729import org .apache .pulsar .client .api .Consumer ;
2830import org .apache .pulsar .client .api .ConsumerBuilder ;
2931import org .apache .pulsar .client .api .PulsarClient ;
@@ -146,6 +148,12 @@ protected void ensureTopicNamesFullyQualified(ConsumerBuilder<T> builder) {
146148 var fullyQualifiedTopics = topics .stream ().map (this .topicBuilder ::getFullyQualifiedNameForTopic ).toList ();
147149 builderImpl .getConf ().setTopicNames (new HashSet <>(fullyQualifiedTopics ));
148150 }
151+ var topicsPattern = builderImpl .getConf ().getTopicsPattern ();
152+ if (topicsPattern != null && StringUtils .isNoneBlank (topicsPattern .pattern ())) {
153+ var topicsPatternStr = topicsPattern .pattern ();
154+ var fullyQualifiedTopicsPatternStr = this .topicBuilder .getFullyQualifiedNameForTopic (topicsPatternStr );
155+ builderImpl .getConf ().setTopicsPattern (Pattern .compile (fullyQualifiedTopicsPatternStr ));
156+ }
149157 }
150158
151159}
You can’t perform that action at this time.
0 commit comments