-
Notifications
You must be signed in to change notification settings - Fork 13.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FLINK-28022][python] Support Google Cloud PubSub connector in Python DataStream API #20627
base: master
Are you sure you want to change the base?
Conversation
@dianfu Could you review for me? Thanks a lot! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pengmide Thanks very much for the PR. Very sorry for the late response.
@@ -101,4 +101,40 @@ under the License. | |||
<scope>test</scope> | |||
</dependency> | |||
</dependencies> | |||
|
|||
<build> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great to add a module flink-sql-connector-gcp-pubsub and move the following logic there.
deserialization_schema._j_serialization_schema) | ||
return PubSubSink.ProjectNameBuilder(_j_serialization_schema) | ||
|
||
class ProjectNameBuilder(object): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not call it PubSubSinkBuilder just as the Java API?
_j_project_name = self._j_project_name_builder.withProjectName(project_name) | ||
return PubSubSink.TopicNameBuilder(_j_project_name) | ||
|
||
class TopicNameBuilder(object): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to merge it with PubSubSinkBuilder and call it PubSubSinkBuilder
""" | ||
JEmulatorCredentialsProvider = get_gateway().jvm. \ | ||
org.apache.flink.streaming.connectors.gcp.pubsub.emulator.EmulatorCredentialsProvider | ||
return Credentials(JEmulatorCredentialsProvider.create().getCredentials()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return Credentials(JEmulatorCredentialsProvider.create().getCredentials()) | |
return Credentials(JEmulatorCredentials.getInstance())? |
@@ -73,6 +73,13 @@ def _install(): | |||
setattr(connectors, 'StreamFormat', file_system.StreamFormat) | |||
setattr(connectors, 'StreamingFileSink', file_system.StreamingFileSink) | |||
|
|||
# pubsub | |||
from pyflink.datastream.connectors import pubsub |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for backward compatibility. Since pubsub is newly introduced, so this is not necessary and could be removed.
Besides, we may need to add some documentation here: https://github.com/apache/flink/blob/master/flink-python/pyflink/datastream/__init__.py#L209
What is the purpose of the change
Improve the documentation by adding Python examples.
Brief change log
Verifying this change
Does this pull request potentially affect one of the following parts:
@Public(Evolving)
: (yes / no)Documentation