Skip to content
Permalink
Browse files
[FLINK-27711][python][connector/pulsar] Fix the typo of the method na…
…me from set_topics_pattern to set_topic_pattern

This closes #19774.
  • Loading branch information
deadwind4 authored and dianfu committed May 21, 2022
1 parent 723d886 commit 1ff8d3ec596dc9aebe4d402f6f90902e182ff70e
Showing 2 changed files with 12 additions and 2 deletions.
@@ -311,9 +311,19 @@ def set_topics_pattern(self, topics_pattern: str) -> 'PulsarSourceBuilder':
Set a topic pattern to consume from the java regex str. You can set topics once either with
setTopics or setTopicPattern in this builder.
"""
warnings.warn("set_topics_pattern is deprecated. Use set_topic_pattern instead.",
DeprecationWarning, stacklevel=2)
self._j_pulsar_source_builder.setTopicPattern(topics_pattern)
return self

def set_topic_pattern(self, topic_pattern: str) -> 'PulsarSourceBuilder':
"""
Set a topic pattern to consume from the java regex str. You can set topics once either with
setTopics or setTopicPattern in this builder.
"""
self._j_pulsar_source_builder.setTopicPattern(topic_pattern)
return self

def set_start_cursor(self, start_cursor: StartCursor) -> 'PulsarSourceBuilder':
"""
Specify from which offsets the PulsarSource should start consume from by providing an
@@ -242,7 +242,7 @@ def test_source_set_topics_pattern(self):
PulsarSource.builder() \
.set_service_url('pulsar://localhost:6650') \
.set_admin_url('http://localhost:8080') \
.set_topics_pattern('ada.*') \
.set_topic_pattern('ada.*') \
.set_subscription_name('ff') \
.set_deserialization_schema(
PulsarDeserializationSchema.flink_schema(SimpleStringSchema())) \
@@ -254,7 +254,7 @@ def test_source_deprecated_method(self):
pulsar_source = PulsarSource.builder() \
.set_service_url('pulsar://localhost:6650') \
.set_admin_url('http://localhost:8080') \
.set_topics('ada') \
.set_topics_pattern('ada.*') \
.set_deserialization_schema(
PulsarDeserializationSchema.flink_type_info(Types.STRING(), None)) \
.set_subscription_name('ff') \

0 comments on commit 1ff8d3e

Please sign in to comment.