You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/08/16 06:42:55 UTC

[GitHub] [flink] shuiqiangchen opened a new pull request #13161: [FLINK-18886][python] Support Kafka connectors for Python DataStream …

shuiqiangchen opened a new pull request #13161:
URL: https://github.com/apache/flink/pull/13161


   <!--
   *Thank you very much for contributing to Apache Flink - we are happy that you want to help us improve Flink. To help the community review your contribution in the best possible way, please go through the checklist below, which will get the contribution into a shape in which it can be best reviewed.*
   
   *Please understand that we do not do this to make contributions to Flink a hassle. In order to uphold a high standard of quality for code contributions, while at the same time managing a large number of contributions, we need contributors to prepare the contributions well, and give reviewers enough contextual information for the review. Please also understand that contributions that do not follow this guide will take longer to review and thus typically be picked up with lower priority by the community.*
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [JIRA issue](https://issues.apache.org/jira/projects/FLINK/issues). Exceptions are made for typos in JavaDoc or documentation files, which need no JIRA issue.
     
     - Name the pull request in the form "[FLINK-XXXX] [component] Title of the pull request", where *FLINK-XXXX* should be replaced by the actual issue number. Skip *component* if you are unsure about which is the best component.
     Typo fixes that have no associated JIRA issue should be named following this pattern: `[hotfix] [docs] Fix typo in event time introduction` or `[hotfix] [javadocs] Expand JavaDoc for PuncuatedWatermarkGenerator`.
   
     - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
     
     - Make sure that the change passes the automated tests, i.e., `mvn clean verify` passes. You can set up Azure Pipelines CI to do that following [this guide](https://cwiki.apache.org/confluence/display/FLINK/Azure+Pipelines#AzurePipelines-Tutorial:SettingupAzurePipelinesforaforkoftheFlinkrepository).
   
     - Each pull request should address only one issue, not mix up code from multiple issues.
     
     - Each commit in the pull request has a meaningful commit message (including the JIRA id)
   
     - Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below.
   
   
   **(The sections below can be removed for hotfixes of typos)**
   -->
   
   ## What is the purpose of the change
   
   Add Kafka connectors for Python DataStream API, supported versions are 0.10.x, 0.11.x and universal.
   
   ## Brief change log
   
   - Added FlinkKafkaConsumer010, FlinkKafkaConsumer011 and FlinkKafkaConsuer
   - Added FlinkKafkaProducer010, FlinkKafkaProducer011 and FlinkKafkaProducer
   
   ## Verifying this change
   
   This pull request has test cases covered by FlinkKafkaTest in test_connectors.py
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): ( no)
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: ( no)
     - The serializers: (no)
     - The runtime per-record code paths (performance sensitive): (no)
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (no)
     - The S3 file system connector: (no)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (no)
     - If yes, how is the feature documented? ( not documented)
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #13161: [FLINK-18886][python] Support Kafka connectors for Python DataStream …

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13161:
URL: https://github.com/apache/flink/pull/13161#issuecomment-674488916


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "5195ef99046f3b16c83107f1dc35569ee8942347",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5560",
       "triggerID" : "5195ef99046f3b16c83107f1dc35569ee8942347",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 5195ef99046f3b16c83107f1dc35569ee8942347 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5560) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #13161: [FLINK-18886][python] Support Kafka connectors for Python DataStream …

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13161:
URL: https://github.com/apache/flink/pull/13161#issuecomment-674488916


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "5195ef99046f3b16c83107f1dc35569ee8942347",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5560",
       "triggerID" : "5195ef99046f3b16c83107f1dc35569ee8942347",
       "triggerType" : "PUSH"
     }, {
       "hash" : "300e5ccc623a584546e60dfbaf8f23c69f726838",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5602",
       "triggerID" : "300e5ccc623a584546e60dfbaf8f23c69f726838",
       "triggerType" : "PUSH"
     }, {
       "hash" : "4fd43cac2195bf69302087ed5a88249dc57b7dd5",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "4fd43cac2195bf69302087ed5a88249dc57b7dd5",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 5195ef99046f3b16c83107f1dc35569ee8942347 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5560) 
   * 300e5ccc623a584546e60dfbaf8f23c69f726838 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5602) 
   * 4fd43cac2195bf69302087ed5a88249dc57b7dd5 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] shuiqiangchen commented on pull request #13161: [FLINK-18886][python] Support Kafka connectors for Python DataStream …

Posted by GitBox <gi...@apache.org>.
shuiqiangchen commented on pull request #13161:
URL: https://github.com/apache/flink/pull/13161#issuecomment-674778574


   @hequn8128 Thank you for your comments, I have updated the pr according to your suggestions, please have a look at it.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #13161: [FLINK-18886][python] Support Kafka connectors for Python DataStream …

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13161:
URL: https://github.com/apache/flink/pull/13161#issuecomment-674488916


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "5195ef99046f3b16c83107f1dc35569ee8942347",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5560",
       "triggerID" : "5195ef99046f3b16c83107f1dc35569ee8942347",
       "triggerType" : "PUSH"
     }, {
       "hash" : "300e5ccc623a584546e60dfbaf8f23c69f726838",
       "status" : "CANCELED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5602",
       "triggerID" : "300e5ccc623a584546e60dfbaf8f23c69f726838",
       "triggerType" : "PUSH"
     }, {
       "hash" : "4fd43cac2195bf69302087ed5a88249dc57b7dd5",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5616",
       "triggerID" : "4fd43cac2195bf69302087ed5a88249dc57b7dd5",
       "triggerType" : "PUSH"
     }, {
       "hash" : "ac58820e47017cd8c7b1a4345f167d7f78c703ab",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "ac58820e47017cd8c7b1a4345f167d7f78c703ab",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 300e5ccc623a584546e60dfbaf8f23c69f726838 Azure: [CANCELED](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5602) 
   * 4fd43cac2195bf69302087ed5a88249dc57b7dd5 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5616) 
   * ac58820e47017cd8c7b1a4345f167d7f78c703ab UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #13161: [FLINK-18886][python] Support Kafka connectors for Python DataStream …

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13161:
URL: https://github.com/apache/flink/pull/13161#issuecomment-674488916


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "5195ef99046f3b16c83107f1dc35569ee8942347",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5560",
       "triggerID" : "5195ef99046f3b16c83107f1dc35569ee8942347",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 5195ef99046f3b16c83107f1dc35569ee8942347 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5560) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] hequn8128 commented on a change in pull request #13161: [FLINK-18886][python] Support Kafka connectors for Python DataStream …

Posted by GitBox <gi...@apache.org>.
hequn8128 commented on a change in pull request #13161:
URL: https://github.com/apache/flink/pull/13161#discussion_r471206526



##########
File path: flink-python/pyflink/datastream/tests/test_connectors.py
##########
@@ -0,0 +1,97 @@
+################################################################################
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################
+
+from pyflink.common import typeinfo
+from pyflink.common.serialization_schemas import JsonRowDeserializationSchema, \
+    JsonRowSerializationSchema
+from pyflink.common.typeinfo import Types
+from pyflink.datastream import StreamExecutionEnvironment
+from pyflink.datastream.connectors import FlinkKafkaConsumer010, FlinkKafkaProducer010, \
+    FlinkKafkaConsumer011, FlinkKafkaProducer011, FlinkKafkaConsumer, FlinkKafkaProducer
+from pyflink.java_gateway import get_gateway
+from pyflink.testing.test_case_utils import PyFlinkTestCase, _load_specific_flink_module_jars, \
+    get_private_field, invoke_java_object_method
+
+
+class FlinkKafkaTest(PyFlinkTestCase):
+
+    def setUp(self) -> None:
+        self.env = StreamExecutionEnvironment.get_execution_environment()
+        self._cxt_clz_loader = get_gateway().jvm.Thread.currentThread().getContextClassLoader()

Review comment:
       Add comments for the self._cxt_clz_loader during setUp and tearDown. 

##########
File path: flink-python/pyflink/datastream/connectors.py
##########
@@ -0,0 +1,546 @@
+################################################################################
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################
+from typing import Dict, List, Union
+
+from pyflink.common.serialization_schemas import DeserializationSchema, SerializationSchema
+from pyflink.datastream.functions import SourceFunction, SinkFunction
+from pyflink.java_gateway import get_gateway
+
+
+class FlinkKafkaConsumerBase(SourceFunction):
+    """
+    Base class of all Flink Kafka Consumer data sources. This implements the common behavior across
+    all kafka versions.
+
+    The Kafka version specific behavior is defined mainly in the specific subclasses.
+    """
+
+    def __init__(self, j_flink_kafka_consumer):
+        super(FlinkKafkaConsumerBase, self).__init__(source_func=j_flink_kafka_consumer)
+
+    def set_commit_offsets_on_checkpoints(self, commit_on_checkpoints: bool):
+        """
+        Specifies whether or not the consumer should commit offsets back to kafka on checkpoints.
+        This setting will only have effect if checkpointing is enabled for the job. If checkpointing
+        isn't enabled, only the "auto.commit.enable" (for 0.8) / "enable.auto.commit" (for 0.9+)
+        property settings will be used.
+        """
+        self._j_function = self._j_function \
+            .setCommitOffsetsOnCheckpoints(commit_on_checkpoints)
+        return self
+
+    def set_start_from_earliest(self):
+        """
+        Specifies the consumer to start reading from the earliest offset for all partitions. This
+        lets the consumer ignore any committed group offsets in Zookeeper/ Kafka brokers.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function.setStartFromEarliest()
+        return self
+
+    def set_start_from_latest(self):
+        """
+        Specifies the consuer to start reading from the latest offset for all partitions. This lets
+        the consumer ignore any committed group offsets in Zookeeper / Kafka brokers.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function.setStartFromLatest()
+        return self
+
+    def set_start_from_timestamp(self, startup_offsets_timestamp: int):
+        """
+        Specifies the consumer to start reading partitions from a specified timestamp. The specified
+        timestamp must be before the current timestamp. This lets the consumer ignore any committed
+        group offsets in Zookeeper / Kafka brokers.
+
+        The consumer will look up the earliest offset whose timestamp is greater than or equal to
+        the specific timestamp from Kafka. If there's no such offset, the consumer will use the
+        latest offset to read data from Kafka.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+
+        :param startup_offsets_timestamp: timestamp for the startup offsets, as milliseconds for
+                                          epoch.
+        """
+        self._j_function = self._j_function.setStartFromTimestamp(
+            startup_offsets_timestamp)
+        return self
+
+    def set_start_from_group_offsets(self):
+        """
+        Specifies the consumer to start reading from any committed group offsets found in Zookeeper/
+        Kafka brokers. The 'group.id' property must be set in the configuration properties. If no
+        offset can be found for a partition, the behaviour in 'auto.offset.reset' set in the
+        configuration properties will be used for the partition.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function.setStartFromGroupOffsets()
+        return self
+
+    def disable_filter_restored_partitions_with_subscribed_topics(self):
+        """
+        By default, when restoring from a checkpoint / savepoint, the consumer always ignores
+        restored partitions that are no longer associated with the current specified topics or topic
+        pattern to subscribe to.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function \
+            .disableFilterRestoredPartitionsWithSubscribedTopics()
+        return self
+
+    def get_produced_type(self):
+        return self._j_function.getProducedType()
+
+
+class FlinkKafkaConsumer010(FlinkKafkaConsumerBase):
+    """
+    The Flink Kafka Consumer is a streaming data source that pulls a parallel data stream from
+    Apache Kafka 0.10.x. The consumer can run in multiple parallel instances, each of which will
+    pull data from one or more Kafka partitions.
+
+    The Flink Kafka Consumer participates in checkpointing and guarantees that no data is lost
+    during a failure, and taht the computation processes elements 'exactly once. (These guarantees
+    naturally assume that Kafka itself does not loose any data.)
+
+    Please note that Flink snapshots the offsets internally as part of its distributed checkpoints.
+    The offsets committed to Kafka / Zookeeper are only to bring the outside view of progress in
+    sync with Flink's view of the progress. That way, monitoring and other jobs can get a view of
+    how far the Flink Kafka consumer has consumed a topic.
+
+    Please refer to Kafka's documentation for the available configuration properties:
+    http://kafka.apache.org/documentation.html#newconsumerconfigs
+    """
+
+    def __init__(self, topics: Union[str, List[str]], deserialization_schema: DeserializationSchema,
+                 properties: Dict):
+        """
+        Creates a new Kafka streaming source consumer for Kafka 0.10.x.
+
+        This constructor allows passing multiple topics to the consumer.
+
+        :param topics: The Kafka topics to read from.
+        :param deserialization_schema: The de-/serializer used to convert between Kafka's byte
+                                       messages and Flink's objects.
+        :param properties: The properties that are used to configure both the fetcher and the offset
+                           handler.
+        """
+        if not isinstance(topics, list):
+            topics = [topics]
+        gateway = get_gateway()
+        j_properties = gateway.jvm.java.util.Properties()
+        for key, value in properties.items():
+            j_properties.setProperty(key, value)
+
+        JFlinkKafkaConsumer010 = gateway.jvm \
+            .org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer010
+        j_flink_kafka_consumer_010 = \
+            JFlinkKafkaConsumer010(topics,
+                                   deserialization_schema._j_deserialization_schema,
+                                   j_properties)
+        super(FlinkKafkaConsumer010, self).__init__(
+            j_flink_kafka_consumer=j_flink_kafka_consumer_010)
+
+
+class FlinkKafkaConsumer011(FlinkKafkaConsumerBase):
+    """
+    The Flink Kafka Consumer is a streaming data source that pulls a parallel data stream from
+    Apache Kafka 0.10.x. The consumer can run in multiple parallel instances, each of which will
+    pull data from one or more Kafka partitions.
+
+    The Flink Kafka Consumer participates in checkpointing and guarantees that no data is lost
+    during a failure, and taht the computation processes elements 'exactly once. (These guarantees
+    naturally assume that Kafka itself does not loose any data.)
+
+    Please note that Flink snapshots the offsets internally as part of its distributed checkpoints.
+    The offsets committed to Kafka / Zookeeper are only to bring the outside view of progress in
+    sync with Flink's view of the progress. That way, monitoring and other jobs can get a view of
+    how far the Flink Kafka consumer has consumed a topic.
+
+    Please refer to Kafka's documentation for the available configuration properties:
+    http://kafka.apache.org/documentation.html#newconsumerconfigs
+    """
+
+    def __init__(self, topics: Union[str, List[str]], deserialization_schema: DeserializationSchema,
+                 properties: Dict):
+        """
+        Creates a new Kafka streaming source consumer for Kafka 0.10.x.
+
+        This constructor allows passing multiple topics to the consumer.
+
+        :param topics: The Kafka topics to read from.
+        :param deserialization_schema: The de-/serializer used to convert between Kafka's byte
+                                       messages and Flink's objects.
+        :param properties: The properties that are used to configure both the fetcher and the offset
+                           handler.
+        """
+        if not isinstance(topics, list):
+            topics = [topics]
+        gateway = get_gateway()
+        j_properties = gateway.jvm.java.util.Properties()
+        for key, value in properties.items():
+            j_properties.setProperty(key, value)
+
+        JFlinkKafkaConsumer011 = gateway.jvm \
+            .org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer011
+        j_flink_kafka_consumer_011 = \
+            JFlinkKafkaConsumer011(topics,
+                                   deserialization_schema._j_deserialization_schema,
+                                   j_properties)
+        super(FlinkKafkaConsumer011, self).__init__(j_flink_kafka_consumer_011)
+
+
+class FlinkKafkaConsumer(FlinkKafkaConsumerBase):
+    """
+    The Flink Kafka Consumer is a streaming data source that pulls a parallel data stream from
+    Apache Kafka 0.10.x. The consumer can run in multiple parallel instances, each of which will
+    pull data from one or more Kafka partitions.
+
+    The Flink Kafka Consumer participates in checkpointing and guarantees that no data is lost
+    during a failure, and taht the computation processes elements 'exactly once. (These guarantees
+    naturally assume that Kafka itself does not loose any data.)
+
+    Please note that Flink snapshots the offsets internally as part of its distributed checkpoints.
+    The offsets committed to Kafka / Zookeeper are only to bring the outside view of progress in
+    sync with Flink's view of the progress. That way, monitoring and other jobs can get a view of
+    how far the Flink Kafka consumer has consumed a topic.
+
+    Please refer to Kafka's documentation for the available configuration properties:
+    http://kafka.apache.org/documentation.html#newconsumerconfigs
+    """
+
+    def __init__(self, topics: Union[str, List[str]], deserialization_schema: DeserializationSchema,
+                 properties: Dict):
+        """
+        Creates a new Kafka streaming source consumer for Kafka 0.10.x.
+
+        This constructor allows passing multiple topics to the consumer.
+
+        :param topics: The Kafka topics to read from.
+        :param deserialization_schema: The de-/serializer used to convert between Kafka's byte
+                                       messages and Flink's objects.
+        :param properties: The properties that are used to configure both the fetcher and the offset
+                           handler.
+        """
+        if not isinstance(topics, list):
+            topics = [topics]
+        gateway = get_gateway()
+        j_properties = gateway.jvm.java.util.Properties()
+        for key, value in properties.items():
+            j_properties.setProperty(key, value)
+
+        JFlinkKafkaConsumer = gateway.jvm \
+            .org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer
+        j_flink_kafka_consumer = \
+            JFlinkKafkaConsumer(topics,
+                                deserialization_schema._j_deserialization_schema,
+                                j_properties)
+        super(FlinkKafkaConsumer, self).__init__(
+            j_flink_kafka_consumer=j_flink_kafka_consumer)
+
+
+class FlinkKafkaProducerBase(SinkFunction):
+    """
+    Flink Sink to produce data into a Kafka topic.
+
+    Please note that this producer provides at-least-once reliability guarantees when checkpoints
+    are enabled and set_flush_on_checkpoint(True) is set. Otherwise, the producer doesn;t provid any
+    reliability guarantees.
+    """
+
+    def __init__(self, j_flink_kafka_producer):
+        super(FlinkKafkaProducerBase, self).__init__(sink_func=j_flink_kafka_producer)
+
+    def set_log_failures_only(self, log_failures_only: bool):
+        """
+        Defines whether the producer should fail on errors, or only log them. If this is set to
+        true, then exceptions will be only logged, if set to false, exceptions will be eventually
+        thrown and cause the streaming program to fail (and enter recovery).
+
+        :param log_failures_only: The flag to indicate logging-only on exceptions.
+        """
+        self._j_function.setLogFailuresOnly(log_failures_only)
+
+    def set_flush_on_checkpoint(self, flush_on_checkpoint: bool):
+        """
+        If set to true, the Flink producer will wait for all outstanding messages in the Kafka
+        buffers to be acknowledged by the Kafka producer on a checkpoint.
+
+        This way, the producer can guarantee that messages in the Kafka buffers are part of the
+        checkpoint.
+
+        :param flush_on_checkpoint: Flag indicating the flush mode (true = flush on checkpoint)
+        """
+        self._j_function.setFlushOnCheckpoint(flush_on_checkpoint)
+
+
+class FlinkKafkaProducer010(FlinkKafkaProducerBase):
+    """
+    Flink Sink to produce data into a Kafka topic. This producer is compatible with Kafka 0.10.x.
+    """
+
+    def __init__(self, topic: str, serialization_schema: SerializationSchema,
+                 producer_config: Dict):
+        """
+        Creates a FlinkKafkaProducer for a given topic. The sink produces a DataStream to the topic.
+
+        Using this constructor, the default FlinkFixedPartitioner will be used as the partitioner.
+        This default partitioner maps each sink subtask to a single Kafka partition (i.e. all
+        records received by a sink subtask will end up in the same Kafka partition).
+
+        :param topic: ID of the Kafka topic.
+        :param serialization_schema: User defined key-less serialization schema.
+        :param producer_config: Properties with the producer configuration.
+        """
+        gateway = get_gateway()
+        j_properties = gateway.jvm.java.util.Properties()
+        for key, value in producer_config.items():
+            j_properties.setProperty(key, value)
+
+        JFlinkKafkaProducer010 = gateway.jvm \
+            .org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer010
+        j_flink_kafka_producer = JFlinkKafkaProducer010(
+            topic, serialization_schema._j_serialization_schema, j_properties)
+        super(FlinkKafkaProducer010, self).__init__(j_flink_kafka_producer=j_flink_kafka_producer)
+
+    def set_write_timestamp_to_kafka(self, write_timestamp_to_kafka: bool):
+        """
+        If set to true, Flink will write the (event time) timestamp attached to each record into
+        Kafka. Timestamps must be positive for Kafka to accept them.
+
+        :param write_timestamp_to_kafka: Flag indicating if Flink's internal timestamps are written
+                                         to Kafka.
+        """
+        self._j_function.setWriteTimestampToKafka(write_timestamp_to_kafka)
+
+
+class Semantic(object):

Review comment:
       This class has never been used.

##########
File path: flink-python/pyflink/datastream/connectors.py
##########
@@ -0,0 +1,546 @@
+################################################################################
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################
+from typing import Dict, List, Union
+
+from pyflink.common.serialization_schemas import DeserializationSchema, SerializationSchema
+from pyflink.datastream.functions import SourceFunction, SinkFunction
+from pyflink.java_gateway import get_gateway
+
+
+class FlinkKafkaConsumerBase(SourceFunction):
+    """
+    Base class of all Flink Kafka Consumer data sources. This implements the common behavior across
+    all kafka versions.
+
+    The Kafka version specific behavior is defined mainly in the specific subclasses.
+    """
+
+    def __init__(self, j_flink_kafka_consumer):
+        super(FlinkKafkaConsumerBase, self).__init__(source_func=j_flink_kafka_consumer)
+
+    def set_commit_offsets_on_checkpoints(self, commit_on_checkpoints: bool):
+        """
+        Specifies whether or not the consumer should commit offsets back to kafka on checkpoints.
+        This setting will only have effect if checkpointing is enabled for the job. If checkpointing
+        isn't enabled, only the "auto.commit.enable" (for 0.8) / "enable.auto.commit" (for 0.9+)
+        property settings will be used.
+        """
+        self._j_function = self._j_function \
+            .setCommitOffsetsOnCheckpoints(commit_on_checkpoints)
+        return self
+
+    def set_start_from_earliest(self):
+        """
+        Specifies the consumer to start reading from the earliest offset for all partitions. This
+        lets the consumer ignore any committed group offsets in Zookeeper/ Kafka brokers.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function.setStartFromEarliest()
+        return self
+
+    def set_start_from_latest(self):
+        """
+        Specifies the consuer to start reading from the latest offset for all partitions. This lets
+        the consumer ignore any committed group offsets in Zookeeper / Kafka brokers.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function.setStartFromLatest()
+        return self
+
+    def set_start_from_timestamp(self, startup_offsets_timestamp: int):
+        """
+        Specifies the consumer to start reading partitions from a specified timestamp. The specified
+        timestamp must be before the current timestamp. This lets the consumer ignore any committed
+        group offsets in Zookeeper / Kafka brokers.
+
+        The consumer will look up the earliest offset whose timestamp is greater than or equal to
+        the specific timestamp from Kafka. If there's no such offset, the consumer will use the
+        latest offset to read data from Kafka.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+
+        :param startup_offsets_timestamp: timestamp for the startup offsets, as milliseconds for
+                                          epoch.
+        """
+        self._j_function = self._j_function.setStartFromTimestamp(
+            startup_offsets_timestamp)
+        return self
+
+    def set_start_from_group_offsets(self):
+        """
+        Specifies the consumer to start reading from any committed group offsets found in Zookeeper/
+        Kafka brokers. The 'group.id' property must be set in the configuration properties. If no
+        offset can be found for a partition, the behaviour in 'auto.offset.reset' set in the
+        configuration properties will be used for the partition.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function.setStartFromGroupOffsets()
+        return self
+
+    def disable_filter_restored_partitions_with_subscribed_topics(self):
+        """
+        By default, when restoring from a checkpoint / savepoint, the consumer always ignores
+        restored partitions that are no longer associated with the current specified topics or topic
+        pattern to subscribe to.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function \
+            .disableFilterRestoredPartitionsWithSubscribedTopics()
+        return self
+
+    def get_produced_type(self):
+        return self._j_function.getProducedType()
+
+
+class FlinkKafkaConsumer010(FlinkKafkaConsumerBase):
+    """
+    The Flink Kafka Consumer is a streaming data source that pulls a parallel data stream from
+    Apache Kafka 0.10.x. The consumer can run in multiple parallel instances, each of which will
+    pull data from one or more Kafka partitions.
+
+    The Flink Kafka Consumer participates in checkpointing and guarantees that no data is lost
+    during a failure, and taht the computation processes elements 'exactly once. (These guarantees
+    naturally assume that Kafka itself does not loose any data.)
+
+    Please note that Flink snapshots the offsets internally as part of its distributed checkpoints.
+    The offsets committed to Kafka / Zookeeper are only to bring the outside view of progress in
+    sync with Flink's view of the progress. That way, monitoring and other jobs can get a view of
+    how far the Flink Kafka consumer has consumed a topic.
+
+    Please refer to Kafka's documentation for the available configuration properties:
+    http://kafka.apache.org/documentation.html#newconsumerconfigs
+    """
+
+    def __init__(self, topics: Union[str, List[str]], deserialization_schema: DeserializationSchema,
+                 properties: Dict):
+        """
+        Creates a new Kafka streaming source consumer for Kafka 0.10.x.
+
+        This constructor allows passing multiple topics to the consumer.
+
+        :param topics: The Kafka topics to read from.
+        :param deserialization_schema: The de-/serializer used to convert between Kafka's byte
+                                       messages and Flink's objects.
+        :param properties: The properties that are used to configure both the fetcher and the offset
+                           handler.
+        """
+        if not isinstance(topics, list):
+            topics = [topics]
+        gateway = get_gateway()
+        j_properties = gateway.jvm.java.util.Properties()
+        for key, value in properties.items():
+            j_properties.setProperty(key, value)
+
+        JFlinkKafkaConsumer010 = gateway.jvm \
+            .org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer010
+        j_flink_kafka_consumer_010 = \
+            JFlinkKafkaConsumer010(topics,
+                                   deserialization_schema._j_deserialization_schema,
+                                   j_properties)
+        super(FlinkKafkaConsumer010, self).__init__(
+            j_flink_kafka_consumer=j_flink_kafka_consumer_010)
+
+
+class FlinkKafkaConsumer011(FlinkKafkaConsumerBase):
+    """
+    The Flink Kafka Consumer is a streaming data source that pulls a parallel data stream from
+    Apache Kafka 0.10.x. The consumer can run in multiple parallel instances, each of which will
+    pull data from one or more Kafka partitions.
+
+    The Flink Kafka Consumer participates in checkpointing and guarantees that no data is lost
+    during a failure, and taht the computation processes elements 'exactly once. (These guarantees
+    naturally assume that Kafka itself does not loose any data.)
+
+    Please note that Flink snapshots the offsets internally as part of its distributed checkpoints.
+    The offsets committed to Kafka / Zookeeper are only to bring the outside view of progress in
+    sync with Flink's view of the progress. That way, monitoring and other jobs can get a view of
+    how far the Flink Kafka consumer has consumed a topic.
+
+    Please refer to Kafka's documentation for the available configuration properties:
+    http://kafka.apache.org/documentation.html#newconsumerconfigs
+    """
+
+    def __init__(self, topics: Union[str, List[str]], deserialization_schema: DeserializationSchema,
+                 properties: Dict):
+        """
+        Creates a new Kafka streaming source consumer for Kafka 0.10.x.
+
+        This constructor allows passing multiple topics to the consumer.
+
+        :param topics: The Kafka topics to read from.
+        :param deserialization_schema: The de-/serializer used to convert between Kafka's byte
+                                       messages and Flink's objects.
+        :param properties: The properties that are used to configure both the fetcher and the offset
+                           handler.
+        """
+        if not isinstance(topics, list):
+            topics = [topics]
+        gateway = get_gateway()
+        j_properties = gateway.jvm.java.util.Properties()
+        for key, value in properties.items():
+            j_properties.setProperty(key, value)
+
+        JFlinkKafkaConsumer011 = gateway.jvm \
+            .org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer011
+        j_flink_kafka_consumer_011 = \
+            JFlinkKafkaConsumer011(topics,
+                                   deserialization_schema._j_deserialization_schema,
+                                   j_properties)
+        super(FlinkKafkaConsumer011, self).__init__(j_flink_kafka_consumer_011)
+
+
+class FlinkKafkaConsumer(FlinkKafkaConsumerBase):
+    """
+    The Flink Kafka Consumer is a streaming data source that pulls a parallel data stream from
+    Apache Kafka 0.10.x. The consumer can run in multiple parallel instances, each of which will
+    pull data from one or more Kafka partitions.
+
+    The Flink Kafka Consumer participates in checkpointing and guarantees that no data is lost
+    during a failure, and taht the computation processes elements 'exactly once. (These guarantees
+    naturally assume that Kafka itself does not loose any data.)
+
+    Please note that Flink snapshots the offsets internally as part of its distributed checkpoints.
+    The offsets committed to Kafka / Zookeeper are only to bring the outside view of progress in
+    sync with Flink's view of the progress. That way, monitoring and other jobs can get a view of
+    how far the Flink Kafka consumer has consumed a topic.
+
+    Please refer to Kafka's documentation for the available configuration properties:
+    http://kafka.apache.org/documentation.html#newconsumerconfigs
+    """
+
+    def __init__(self, topics: Union[str, List[str]], deserialization_schema: DeserializationSchema,
+                 properties: Dict):
+        """
+        Creates a new Kafka streaming source consumer for Kafka 0.10.x.
+
+        This constructor allows passing multiple topics to the consumer.
+
+        :param topics: The Kafka topics to read from.
+        :param deserialization_schema: The de-/serializer used to convert between Kafka's byte
+                                       messages and Flink's objects.
+        :param properties: The properties that are used to configure both the fetcher and the offset
+                           handler.
+        """
+        if not isinstance(topics, list):
+            topics = [topics]
+        gateway = get_gateway()
+        j_properties = gateway.jvm.java.util.Properties()
+        for key, value in properties.items():
+            j_properties.setProperty(key, value)
+
+        JFlinkKafkaConsumer = gateway.jvm \
+            .org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer
+        j_flink_kafka_consumer = \
+            JFlinkKafkaConsumer(topics,
+                                deserialization_schema._j_deserialization_schema,
+                                j_properties)
+        super(FlinkKafkaConsumer, self).__init__(
+            j_flink_kafka_consumer=j_flink_kafka_consumer)
+
+
+class FlinkKafkaProducerBase(SinkFunction):

Review comment:
       Also extends from abc.ABC indicating that this is a abstract class.

##########
File path: flink-python/pyflink/datastream/connectors.py
##########
@@ -0,0 +1,546 @@
+################################################################################
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################
+from typing import Dict, List, Union
+
+from pyflink.common.serialization_schemas import DeserializationSchema, SerializationSchema
+from pyflink.datastream.functions import SourceFunction, SinkFunction
+from pyflink.java_gateway import get_gateway
+
+
+class FlinkKafkaConsumerBase(SourceFunction):

Review comment:
       Also extends from abc.ABC indicating that this is a abstract class.

##########
File path: flink-python/pyflink/datastream/connectors.py
##########
@@ -0,0 +1,546 @@
+################################################################################
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################
+from typing import Dict, List, Union
+
+from pyflink.common.serialization_schemas import DeserializationSchema, SerializationSchema
+from pyflink.datastream.functions import SourceFunction, SinkFunction
+from pyflink.java_gateway import get_gateway
+
+
+class FlinkKafkaConsumerBase(SourceFunction):
+    """
+    Base class of all Flink Kafka Consumer data sources. This implements the common behavior across
+    all kafka versions.
+
+    The Kafka version specific behavior is defined mainly in the specific subclasses.
+    """
+
+    def __init__(self, j_flink_kafka_consumer):
+        super(FlinkKafkaConsumerBase, self).__init__(source_func=j_flink_kafka_consumer)
+
+    def set_commit_offsets_on_checkpoints(self, commit_on_checkpoints: bool):
+        """
+        Specifies whether or not the consumer should commit offsets back to kafka on checkpoints.
+        This setting will only have effect if checkpointing is enabled for the job. If checkpointing
+        isn't enabled, only the "auto.commit.enable" (for 0.8) / "enable.auto.commit" (for 0.9+)
+        property settings will be used.
+        """
+        self._j_function = self._j_function \
+            .setCommitOffsetsOnCheckpoints(commit_on_checkpoints)
+        return self
+
+    def set_start_from_earliest(self):
+        """
+        Specifies the consumer to start reading from the earliest offset for all partitions. This
+        lets the consumer ignore any committed group offsets in Zookeeper/ Kafka brokers.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function.setStartFromEarliest()
+        return self
+
+    def set_start_from_latest(self):
+        """
+        Specifies the consuer to start reading from the latest offset for all partitions. This lets
+        the consumer ignore any committed group offsets in Zookeeper / Kafka brokers.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function.setStartFromLatest()
+        return self
+
+    def set_start_from_timestamp(self, startup_offsets_timestamp: int):
+        """
+        Specifies the consumer to start reading partitions from a specified timestamp. The specified
+        timestamp must be before the current timestamp. This lets the consumer ignore any committed
+        group offsets in Zookeeper / Kafka brokers.
+
+        The consumer will look up the earliest offset whose timestamp is greater than or equal to
+        the specific timestamp from Kafka. If there's no such offset, the consumer will use the
+        latest offset to read data from Kafka.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+
+        :param startup_offsets_timestamp: timestamp for the startup offsets, as milliseconds for
+                                          epoch.
+        """
+        self._j_function = self._j_function.setStartFromTimestamp(
+            startup_offsets_timestamp)
+        return self
+
+    def set_start_from_group_offsets(self):
+        """
+        Specifies the consumer to start reading from any committed group offsets found in Zookeeper/
+        Kafka brokers. The 'group.id' property must be set in the configuration properties. If no
+        offset can be found for a partition, the behaviour in 'auto.offset.reset' set in the
+        configuration properties will be used for the partition.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function.setStartFromGroupOffsets()
+        return self
+
+    def disable_filter_restored_partitions_with_subscribed_topics(self):
+        """
+        By default, when restoring from a checkpoint / savepoint, the consumer always ignores
+        restored partitions that are no longer associated with the current specified topics or topic
+        pattern to subscribe to.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function \
+            .disableFilterRestoredPartitionsWithSubscribedTopics()
+        return self
+
+    def get_produced_type(self):
+        return self._j_function.getProducedType()
+
+
+class FlinkKafkaConsumer010(FlinkKafkaConsumerBase):
+    """
+    The Flink Kafka Consumer is a streaming data source that pulls a parallel data stream from
+    Apache Kafka 0.10.x. The consumer can run in multiple parallel instances, each of which will
+    pull data from one or more Kafka partitions.
+
+    The Flink Kafka Consumer participates in checkpointing and guarantees that no data is lost
+    during a failure, and taht the computation processes elements 'exactly once. (These guarantees
+    naturally assume that Kafka itself does not loose any data.)
+
+    Please note that Flink snapshots the offsets internally as part of its distributed checkpoints.
+    The offsets committed to Kafka / Zookeeper are only to bring the outside view of progress in
+    sync with Flink's view of the progress. That way, monitoring and other jobs can get a view of
+    how far the Flink Kafka consumer has consumed a topic.
+
+    Please refer to Kafka's documentation for the available configuration properties:
+    http://kafka.apache.org/documentation.html#newconsumerconfigs
+    """
+
+    def __init__(self, topics: Union[str, List[str]], deserialization_schema: DeserializationSchema,
+                 properties: Dict):
+        """
+        Creates a new Kafka streaming source consumer for Kafka 0.10.x.
+
+        This constructor allows passing multiple topics to the consumer.
+
+        :param topics: The Kafka topics to read from.
+        :param deserialization_schema: The de-/serializer used to convert between Kafka's byte
+                                       messages and Flink's objects.
+        :param properties: The properties that are used to configure both the fetcher and the offset
+                           handler.
+        """
+        if not isinstance(topics, list):
+            topics = [topics]
+        gateway = get_gateway()
+        j_properties = gateway.jvm.java.util.Properties()
+        for key, value in properties.items():
+            j_properties.setProperty(key, value)
+
+        JFlinkKafkaConsumer010 = gateway.jvm \
+            .org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer010
+        j_flink_kafka_consumer_010 = \
+            JFlinkKafkaConsumer010(topics,
+                                   deserialization_schema._j_deserialization_schema,
+                                   j_properties)

Review comment:
       Can we extract a method for these logics so that can be reused by all three sub-classes.

##########
File path: flink-python/pyflink/datastream/connectors.py
##########
@@ -0,0 +1,546 @@
+################################################################################
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################
+from typing import Dict, List, Union
+
+from pyflink.common.serialization_schemas import DeserializationSchema, SerializationSchema
+from pyflink.datastream.functions import SourceFunction, SinkFunction
+from pyflink.java_gateway import get_gateway
+
+
+class FlinkKafkaConsumerBase(SourceFunction):
+    """
+    Base class of all Flink Kafka Consumer data sources. This implements the common behavior across
+    all kafka versions.
+
+    The Kafka version specific behavior is defined mainly in the specific subclasses.
+    """
+
+    def __init__(self, j_flink_kafka_consumer):
+        super(FlinkKafkaConsumerBase, self).__init__(source_func=j_flink_kafka_consumer)
+
+    def set_commit_offsets_on_checkpoints(self, commit_on_checkpoints: bool):
+        """
+        Specifies whether or not the consumer should commit offsets back to kafka on checkpoints.
+        This setting will only have effect if checkpointing is enabled for the job. If checkpointing
+        isn't enabled, only the "auto.commit.enable" (for 0.8) / "enable.auto.commit" (for 0.9+)
+        property settings will be used.
+        """
+        self._j_function = self._j_function \
+            .setCommitOffsetsOnCheckpoints(commit_on_checkpoints)
+        return self
+
+    def set_start_from_earliest(self):
+        """
+        Specifies the consumer to start reading from the earliest offset for all partitions. This
+        lets the consumer ignore any committed group offsets in Zookeeper/ Kafka brokers.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function.setStartFromEarliest()
+        return self
+
+    def set_start_from_latest(self):
+        """
+        Specifies the consuer to start reading from the latest offset for all partitions. This lets
+        the consumer ignore any committed group offsets in Zookeeper / Kafka brokers.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function.setStartFromLatest()
+        return self
+
+    def set_start_from_timestamp(self, startup_offsets_timestamp: int):
+        """
+        Specifies the consumer to start reading partitions from a specified timestamp. The specified
+        timestamp must be before the current timestamp. This lets the consumer ignore any committed
+        group offsets in Zookeeper / Kafka brokers.
+
+        The consumer will look up the earliest offset whose timestamp is greater than or equal to
+        the specific timestamp from Kafka. If there's no such offset, the consumer will use the
+        latest offset to read data from Kafka.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+
+        :param startup_offsets_timestamp: timestamp for the startup offsets, as milliseconds for
+                                          epoch.
+        """
+        self._j_function = self._j_function.setStartFromTimestamp(
+            startup_offsets_timestamp)
+        return self
+
+    def set_start_from_group_offsets(self):
+        """
+        Specifies the consumer to start reading from any committed group offsets found in Zookeeper/
+        Kafka brokers. The 'group.id' property must be set in the configuration properties. If no
+        offset can be found for a partition, the behaviour in 'auto.offset.reset' set in the
+        configuration properties will be used for the partition.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function.setStartFromGroupOffsets()
+        return self
+
+    def disable_filter_restored_partitions_with_subscribed_topics(self):
+        """
+        By default, when restoring from a checkpoint / savepoint, the consumer always ignores
+        restored partitions that are no longer associated with the current specified topics or topic
+        pattern to subscribe to.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function \
+            .disableFilterRestoredPartitionsWithSubscribedTopics()
+        return self
+
+    def get_produced_type(self):
+        return self._j_function.getProducedType()

Review comment:
       Can't return a java typeinfo.

##########
File path: flink-python/pyflink/datastream/connectors.py
##########
@@ -0,0 +1,546 @@
+################################################################################
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################
+from typing import Dict, List, Union
+
+from pyflink.common.serialization_schemas import DeserializationSchema, SerializationSchema
+from pyflink.datastream.functions import SourceFunction, SinkFunction
+from pyflink.java_gateway import get_gateway
+
+
+class FlinkKafkaConsumerBase(SourceFunction):
+    """
+    Base class of all Flink Kafka Consumer data sources. This implements the common behavior across
+    all kafka versions.
+
+    The Kafka version specific behavior is defined mainly in the specific subclasses.
+    """
+
+    def __init__(self, j_flink_kafka_consumer):
+        super(FlinkKafkaConsumerBase, self).__init__(source_func=j_flink_kafka_consumer)
+
+    def set_commit_offsets_on_checkpoints(self, commit_on_checkpoints: bool):
+        """
+        Specifies whether or not the consumer should commit offsets back to kafka on checkpoints.
+        This setting will only have effect if checkpointing is enabled for the job. If checkpointing
+        isn't enabled, only the "auto.commit.enable" (for 0.8) / "enable.auto.commit" (for 0.9+)
+        property settings will be used.
+        """
+        self._j_function = self._j_function \
+            .setCommitOffsetsOnCheckpoints(commit_on_checkpoints)
+        return self
+
+    def set_start_from_earliest(self):
+        """
+        Specifies the consumer to start reading from the earliest offset for all partitions. This
+        lets the consumer ignore any committed group offsets in Zookeeper/ Kafka brokers.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function.setStartFromEarliest()
+        return self
+
+    def set_start_from_latest(self):
+        """
+        Specifies the consuer to start reading from the latest offset for all partitions. This lets
+        the consumer ignore any committed group offsets in Zookeeper / Kafka brokers.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function.setStartFromLatest()
+        return self
+
+    def set_start_from_timestamp(self, startup_offsets_timestamp: int):
+        """
+        Specifies the consumer to start reading partitions from a specified timestamp. The specified
+        timestamp must be before the current timestamp. This lets the consumer ignore any committed
+        group offsets in Zookeeper / Kafka brokers.
+
+        The consumer will look up the earliest offset whose timestamp is greater than or equal to
+        the specific timestamp from Kafka. If there's no such offset, the consumer will use the
+        latest offset to read data from Kafka.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+
+        :param startup_offsets_timestamp: timestamp for the startup offsets, as milliseconds for
+                                          epoch.
+        """
+        self._j_function = self._j_function.setStartFromTimestamp(
+            startup_offsets_timestamp)
+        return self
+
+    def set_start_from_group_offsets(self):
+        """
+        Specifies the consumer to start reading from any committed group offsets found in Zookeeper/
+        Kafka brokers. The 'group.id' property must be set in the configuration properties. If no
+        offset can be found for a partition, the behaviour in 'auto.offset.reset' set in the
+        configuration properties will be used for the partition.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function.setStartFromGroupOffsets()
+        return self
+
+    def disable_filter_restored_partitions_with_subscribed_topics(self):
+        """
+        By default, when restoring from a checkpoint / savepoint, the consumer always ignores
+        restored partitions that are no longer associated with the current specified topics or topic
+        pattern to subscribe to.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function \
+            .disableFilterRestoredPartitionsWithSubscribedTopics()
+        return self
+
+    def get_produced_type(self):
+        return self._j_function.getProducedType()
+
+
+class FlinkKafkaConsumer010(FlinkKafkaConsumerBase):
+    """
+    The Flink Kafka Consumer is a streaming data source that pulls a parallel data stream from
+    Apache Kafka 0.10.x. The consumer can run in multiple parallel instances, each of which will
+    pull data from one or more Kafka partitions.
+
+    The Flink Kafka Consumer participates in checkpointing and guarantees that no data is lost
+    during a failure, and taht the computation processes elements 'exactly once. (These guarantees
+    naturally assume that Kafka itself does not loose any data.)
+
+    Please note that Flink snapshots the offsets internally as part of its distributed checkpoints.
+    The offsets committed to Kafka / Zookeeper are only to bring the outside view of progress in
+    sync with Flink's view of the progress. That way, monitoring and other jobs can get a view of
+    how far the Flink Kafka consumer has consumed a topic.
+
+    Please refer to Kafka's documentation for the available configuration properties:
+    http://kafka.apache.org/documentation.html#newconsumerconfigs
+    """
+
+    def __init__(self, topics: Union[str, List[str]], deserialization_schema: DeserializationSchema,
+                 properties: Dict):
+        """
+        Creates a new Kafka streaming source consumer for Kafka 0.10.x.
+
+        This constructor allows passing multiple topics to the consumer.
+
+        :param topics: The Kafka topics to read from.
+        :param deserialization_schema: The de-/serializer used to convert between Kafka's byte
+                                       messages and Flink's objects.
+        :param properties: The properties that are used to configure both the fetcher and the offset
+                           handler.
+        """
+        if not isinstance(topics, list):
+            topics = [topics]
+        gateway = get_gateway()
+        j_properties = gateway.jvm.java.util.Properties()
+        for key, value in properties.items():
+            j_properties.setProperty(key, value)
+
+        JFlinkKafkaConsumer010 = gateway.jvm \
+            .org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer010
+        j_flink_kafka_consumer_010 = \
+            JFlinkKafkaConsumer010(topics,
+                                   deserialization_schema._j_deserialization_schema,
+                                   j_properties)
+        super(FlinkKafkaConsumer010, self).__init__(
+            j_flink_kafka_consumer=j_flink_kafka_consumer_010)
+
+
+class FlinkKafkaConsumer011(FlinkKafkaConsumerBase):
+    """
+    The Flink Kafka Consumer is a streaming data source that pulls a parallel data stream from
+    Apache Kafka 0.10.x. The consumer can run in multiple parallel instances, each of which will
+    pull data from one or more Kafka partitions.
+
+    The Flink Kafka Consumer participates in checkpointing and guarantees that no data is lost
+    during a failure, and taht the computation processes elements 'exactly once. (These guarantees
+    naturally assume that Kafka itself does not loose any data.)
+
+    Please note that Flink snapshots the offsets internally as part of its distributed checkpoints.
+    The offsets committed to Kafka / Zookeeper are only to bring the outside view of progress in
+    sync with Flink's view of the progress. That way, monitoring and other jobs can get a view of
+    how far the Flink Kafka consumer has consumed a topic.
+
+    Please refer to Kafka's documentation for the available configuration properties:
+    http://kafka.apache.org/documentation.html#newconsumerconfigs
+    """
+
+    def __init__(self, topics: Union[str, List[str]], deserialization_schema: DeserializationSchema,
+                 properties: Dict):
+        """
+        Creates a new Kafka streaming source consumer for Kafka 0.10.x.
+
+        This constructor allows passing multiple topics to the consumer.
+
+        :param topics: The Kafka topics to read from.
+        :param deserialization_schema: The de-/serializer used to convert between Kafka's byte
+                                       messages and Flink's objects.
+        :param properties: The properties that are used to configure both the fetcher and the offset
+                           handler.
+        """
+        if not isinstance(topics, list):
+            topics = [topics]
+        gateway = get_gateway()
+        j_properties = gateway.jvm.java.util.Properties()
+        for key, value in properties.items():
+            j_properties.setProperty(key, value)
+
+        JFlinkKafkaConsumer011 = gateway.jvm \
+            .org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer011
+        j_flink_kafka_consumer_011 = \
+            JFlinkKafkaConsumer011(topics,
+                                   deserialization_schema._j_deserialization_schema,
+                                   j_properties)
+        super(FlinkKafkaConsumer011, self).__init__(j_flink_kafka_consumer_011)
+
+
+class FlinkKafkaConsumer(FlinkKafkaConsumerBase):
+    """
+    The Flink Kafka Consumer is a streaming data source that pulls a parallel data stream from
+    Apache Kafka 0.10.x. The consumer can run in multiple parallel instances, each of which will
+    pull data from one or more Kafka partitions.
+
+    The Flink Kafka Consumer participates in checkpointing and guarantees that no data is lost
+    during a failure, and taht the computation processes elements 'exactly once. (These guarantees
+    naturally assume that Kafka itself does not loose any data.)
+
+    Please note that Flink snapshots the offsets internally as part of its distributed checkpoints.
+    The offsets committed to Kafka / Zookeeper are only to bring the outside view of progress in
+    sync with Flink's view of the progress. That way, monitoring and other jobs can get a view of
+    how far the Flink Kafka consumer has consumed a topic.
+
+    Please refer to Kafka's documentation for the available configuration properties:
+    http://kafka.apache.org/documentation.html#newconsumerconfigs
+    """
+
+    def __init__(self, topics: Union[str, List[str]], deserialization_schema: DeserializationSchema,
+                 properties: Dict):
+        """
+        Creates a new Kafka streaming source consumer for Kafka 0.10.x.
+
+        This constructor allows passing multiple topics to the consumer.
+
+        :param topics: The Kafka topics to read from.
+        :param deserialization_schema: The de-/serializer used to convert between Kafka's byte
+                                       messages and Flink's objects.
+        :param properties: The properties that are used to configure both the fetcher and the offset
+                           handler.
+        """
+        if not isinstance(topics, list):
+            topics = [topics]
+        gateway = get_gateway()
+        j_properties = gateway.jvm.java.util.Properties()
+        for key, value in properties.items():
+            j_properties.setProperty(key, value)
+
+        JFlinkKafkaConsumer = gateway.jvm \
+            .org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer
+        j_flink_kafka_consumer = \
+            JFlinkKafkaConsumer(topics,
+                                deserialization_schema._j_deserialization_schema,
+                                j_properties)
+        super(FlinkKafkaConsumer, self).__init__(
+            j_flink_kafka_consumer=j_flink_kafka_consumer)
+
+
+class FlinkKafkaProducerBase(SinkFunction):
+    """
+    Flink Sink to produce data into a Kafka topic.
+
+    Please note that this producer provides at-least-once reliability guarantees when checkpoints
+    are enabled and set_flush_on_checkpoint(True) is set. Otherwise, the producer doesn;t provid any
+    reliability guarantees.
+    """
+
+    def __init__(self, j_flink_kafka_producer):
+        super(FlinkKafkaProducerBase, self).__init__(sink_func=j_flink_kafka_producer)
+
+    def set_log_failures_only(self, log_failures_only: bool):
+        """
+        Defines whether the producer should fail on errors, or only log them. If this is set to
+        true, then exceptions will be only logged, if set to false, exceptions will be eventually
+        thrown and cause the streaming program to fail (and enter recovery).
+
+        :param log_failures_only: The flag to indicate logging-only on exceptions.
+        """
+        self._j_function.setLogFailuresOnly(log_failures_only)
+
+    def set_flush_on_checkpoint(self, flush_on_checkpoint: bool):
+        """
+        If set to true, the Flink producer will wait for all outstanding messages in the Kafka
+        buffers to be acknowledged by the Kafka producer on a checkpoint.
+
+        This way, the producer can guarantee that messages in the Kafka buffers are part of the
+        checkpoint.
+
+        :param flush_on_checkpoint: Flag indicating the flush mode (true = flush on checkpoint)
+        """
+        self._j_function.setFlushOnCheckpoint(flush_on_checkpoint)
+
+
+class FlinkKafkaProducer010(FlinkKafkaProducerBase):
+    """
+    Flink Sink to produce data into a Kafka topic. This producer is compatible with Kafka 0.10.x.
+    """
+
+    def __init__(self, topic: str, serialization_schema: SerializationSchema,
+                 producer_config: Dict):
+        """
+        Creates a FlinkKafkaProducer for a given topic. The sink produces a DataStream to the topic.
+
+        Using this constructor, the default FlinkFixedPartitioner will be used as the partitioner.
+        This default partitioner maps each sink subtask to a single Kafka partition (i.e. all
+        records received by a sink subtask will end up in the same Kafka partition).
+
+        :param topic: ID of the Kafka topic.
+        :param serialization_schema: User defined key-less serialization schema.
+        :param producer_config: Properties with the producer configuration.
+        """
+        gateway = get_gateway()
+        j_properties = gateway.jvm.java.util.Properties()
+        for key, value in producer_config.items():
+            j_properties.setProperty(key, value)
+
+        JFlinkKafkaProducer010 = gateway.jvm \
+            .org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer010
+        j_flink_kafka_producer = JFlinkKafkaProducer010(
+            topic, serialization_schema._j_serialization_schema, j_properties)
+        super(FlinkKafkaProducer010, self).__init__(j_flink_kafka_producer=j_flink_kafka_producer)
+
+    def set_write_timestamp_to_kafka(self, write_timestamp_to_kafka: bool):
+        """
+        If set to true, Flink will write the (event time) timestamp attached to each record into
+        Kafka. Timestamps must be positive for Kafka to accept them.
+
+        :param write_timestamp_to_kafka: Flag indicating if Flink's internal timestamps are written
+                                         to Kafka.
+        """
+        self._j_function.setWriteTimestampToKafka(write_timestamp_to_kafka)
+
+
+class Semantic(object):
+    """
+    Semantics that can be chosen.
+    :data: `EXACTLY_ONCE`:
+    The Flink producer will write all messages in a Kafka transaction that will be committed to
+    the Kafka on a checkpoint. In this mode FlinkKafkaProducer011 sets up a pool of
+    FlinkKafkaProducer. Between each checkpoint there is created new Kafka transaction, which is
+    being committed on FlinkKafkaProducer011.notifyCheckpointComplete(long). If checkpoint
+    complete notifications are running late, FlinkKafkaProducer011 can run out of
+    FlinkKafkaProducers in the pool. In that case any subsequent FlinkKafkaProducer011.snapshot-
+    State() requests will fail and the FlinkKafkaProducer011 will keep using the
+    FlinkKafkaProducer from previous checkpoint. To decrease chances of failing checkpoints
+    there are four options:
+        1. decrease number of max concurrent checkpoints
+        2. make checkpoints mre reliable (so that they complete faster)
+        3. increase delay between checkpoints
+        4. increase size of FlinkKafkaProducers pool
+
+    :data: `AT_LEAST_ONCE`:
+    The Flink producer will wait for all outstanding messages in the Kafka buffers to be
+    acknowledged by the Kafka producer on a checkpoint.
+
+    :data: `NONE`:
+    Means that nothing will be guaranteed. Messages can be lost and/or duplicated in case of
+    failure.
+    """
+
+    EXACTLY_ONCE = 0,
+    AT_LEAST_ONCE = 1,
+    NONE = 2
+
+    @staticmethod
+    def _to_j_semantic(semantic):
+        gateway = get_gateway()
+        JSemantic = gateway.jvm \
+            .org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer011.Semantic
+        if semantic == Semantic.EXACTLY_ONCE:
+            return JSemantic.EXACTLY_ONCE
+        elif semantic == Semantic.AT_LEAST_ONCE:
+            return JSemantic.AT_LEAST_ONCE
+        elif semantic == Semantic.NONE:
+            return JSemantic.NONE
+        else:
+            raise TypeError("Unsupported semantic: %s, supported semantics are: "
+                            "Semantic.EXACTLY_ONCE, Semantic.AT_LEAST_ONCE, Semantic.NONE"
+                            % semantic)
+
+
+class FlinkKafkaProducer011(SinkFunction):

Review comment:
       Maybe we can make this class extends from `FlinkKafkaProducerBase` so that methods can be reused.

##########
File path: flink-python/pyflink/datastream/connectors.py
##########
@@ -0,0 +1,546 @@
+################################################################################
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################
+from typing import Dict, List, Union
+
+from pyflink.common.serialization_schemas import DeserializationSchema, SerializationSchema
+from pyflink.datastream.functions import SourceFunction, SinkFunction
+from pyflink.java_gateway import get_gateway
+
+
+class FlinkKafkaConsumerBase(SourceFunction):
+    """
+    Base class of all Flink Kafka Consumer data sources. This implements the common behavior across
+    all kafka versions.
+
+    The Kafka version specific behavior is defined mainly in the specific subclasses.
+    """
+
+    def __init__(self, j_flink_kafka_consumer):
+        super(FlinkKafkaConsumerBase, self).__init__(source_func=j_flink_kafka_consumer)
+
+    def set_commit_offsets_on_checkpoints(self, commit_on_checkpoints: bool):
+        """
+        Specifies whether or not the consumer should commit offsets back to kafka on checkpoints.
+        This setting will only have effect if checkpointing is enabled for the job. If checkpointing
+        isn't enabled, only the "auto.commit.enable" (for 0.8) / "enable.auto.commit" (for 0.9+)
+        property settings will be used.
+        """
+        self._j_function = self._j_function \
+            .setCommitOffsetsOnCheckpoints(commit_on_checkpoints)
+        return self
+
+    def set_start_from_earliest(self):
+        """
+        Specifies the consumer to start reading from the earliest offset for all partitions. This
+        lets the consumer ignore any committed group offsets in Zookeeper/ Kafka brokers.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function.setStartFromEarliest()
+        return self
+
+    def set_start_from_latest(self):
+        """
+        Specifies the consuer to start reading from the latest offset for all partitions. This lets
+        the consumer ignore any committed group offsets in Zookeeper / Kafka brokers.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function.setStartFromLatest()
+        return self
+
+    def set_start_from_timestamp(self, startup_offsets_timestamp: int):
+        """
+        Specifies the consumer to start reading partitions from a specified timestamp. The specified
+        timestamp must be before the current timestamp. This lets the consumer ignore any committed
+        group offsets in Zookeeper / Kafka brokers.
+
+        The consumer will look up the earliest offset whose timestamp is greater than or equal to
+        the specific timestamp from Kafka. If there's no such offset, the consumer will use the
+        latest offset to read data from Kafka.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+
+        :param startup_offsets_timestamp: timestamp for the startup offsets, as milliseconds for
+                                          epoch.
+        """
+        self._j_function = self._j_function.setStartFromTimestamp(
+            startup_offsets_timestamp)
+        return self
+
+    def set_start_from_group_offsets(self):
+        """
+        Specifies the consumer to start reading from any committed group offsets found in Zookeeper/
+        Kafka brokers. The 'group.id' property must be set in the configuration properties. If no
+        offset can be found for a partition, the behaviour in 'auto.offset.reset' set in the
+        configuration properties will be used for the partition.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function.setStartFromGroupOffsets()
+        return self
+
+    def disable_filter_restored_partitions_with_subscribed_topics(self):
+        """
+        By default, when restoring from a checkpoint / savepoint, the consumer always ignores
+        restored partitions that are no longer associated with the current specified topics or topic
+        pattern to subscribe to.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function \
+            .disableFilterRestoredPartitionsWithSubscribedTopics()
+        return self
+
+    def get_produced_type(self):
+        return self._j_function.getProducedType()
+
+
+class FlinkKafkaConsumer010(FlinkKafkaConsumerBase):
+    """
+    The Flink Kafka Consumer is a streaming data source that pulls a parallel data stream from
+    Apache Kafka 0.10.x. The consumer can run in multiple parallel instances, each of which will
+    pull data from one or more Kafka partitions.
+
+    The Flink Kafka Consumer participates in checkpointing and guarantees that no data is lost
+    during a failure, and taht the computation processes elements 'exactly once. (These guarantees
+    naturally assume that Kafka itself does not loose any data.)
+
+    Please note that Flink snapshots the offsets internally as part of its distributed checkpoints.
+    The offsets committed to Kafka / Zookeeper are only to bring the outside view of progress in
+    sync with Flink's view of the progress. That way, monitoring and other jobs can get a view of
+    how far the Flink Kafka consumer has consumed a topic.
+
+    Please refer to Kafka's documentation for the available configuration properties:
+    http://kafka.apache.org/documentation.html#newconsumerconfigs
+    """
+
+    def __init__(self, topics: Union[str, List[str]], deserialization_schema: DeserializationSchema,
+                 properties: Dict):
+        """
+        Creates a new Kafka streaming source consumer for Kafka 0.10.x.
+
+        This constructor allows passing multiple topics to the consumer.
+
+        :param topics: The Kafka topics to read from.
+        :param deserialization_schema: The de-/serializer used to convert between Kafka's byte
+                                       messages and Flink's objects.
+        :param properties: The properties that are used to configure both the fetcher and the offset
+                           handler.
+        """
+        if not isinstance(topics, list):
+            topics = [topics]
+        gateway = get_gateway()
+        j_properties = gateway.jvm.java.util.Properties()
+        for key, value in properties.items():
+            j_properties.setProperty(key, value)
+
+        JFlinkKafkaConsumer010 = gateway.jvm \
+            .org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer010
+        j_flink_kafka_consumer_010 = \
+            JFlinkKafkaConsumer010(topics,
+                                   deserialization_schema._j_deserialization_schema,
+                                   j_properties)
+        super(FlinkKafkaConsumer010, self).__init__(
+            j_flink_kafka_consumer=j_flink_kafka_consumer_010)
+
+
+class FlinkKafkaConsumer011(FlinkKafkaConsumerBase):
+    """
+    The Flink Kafka Consumer is a streaming data source that pulls a parallel data stream from
+    Apache Kafka 0.10.x. The consumer can run in multiple parallel instances, each of which will
+    pull data from one or more Kafka partitions.
+
+    The Flink Kafka Consumer participates in checkpointing and guarantees that no data is lost
+    during a failure, and taht the computation processes elements 'exactly once. (These guarantees
+    naturally assume that Kafka itself does not loose any data.)
+
+    Please note that Flink snapshots the offsets internally as part of its distributed checkpoints.
+    The offsets committed to Kafka / Zookeeper are only to bring the outside view of progress in
+    sync with Flink's view of the progress. That way, monitoring and other jobs can get a view of
+    how far the Flink Kafka consumer has consumed a topic.
+
+    Please refer to Kafka's documentation for the available configuration properties:
+    http://kafka.apache.org/documentation.html#newconsumerconfigs
+    """
+
+    def __init__(self, topics: Union[str, List[str]], deserialization_schema: DeserializationSchema,
+                 properties: Dict):
+        """
+        Creates a new Kafka streaming source consumer for Kafka 0.10.x.
+
+        This constructor allows passing multiple topics to the consumer.
+
+        :param topics: The Kafka topics to read from.
+        :param deserialization_schema: The de-/serializer used to convert between Kafka's byte
+                                       messages and Flink's objects.
+        :param properties: The properties that are used to configure both the fetcher and the offset
+                           handler.
+        """
+        if not isinstance(topics, list):
+            topics = [topics]
+        gateway = get_gateway()
+        j_properties = gateway.jvm.java.util.Properties()
+        for key, value in properties.items():
+            j_properties.setProperty(key, value)
+
+        JFlinkKafkaConsumer011 = gateway.jvm \
+            .org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer011
+        j_flink_kafka_consumer_011 = \
+            JFlinkKafkaConsumer011(topics,
+                                   deserialization_schema._j_deserialization_schema,
+                                   j_properties)
+        super(FlinkKafkaConsumer011, self).__init__(j_flink_kafka_consumer_011)
+
+
+class FlinkKafkaConsumer(FlinkKafkaConsumerBase):
+    """
+    The Flink Kafka Consumer is a streaming data source that pulls a parallel data stream from
+    Apache Kafka 0.10.x. The consumer can run in multiple parallel instances, each of which will
+    pull data from one or more Kafka partitions.
+
+    The Flink Kafka Consumer participates in checkpointing and guarantees that no data is lost
+    during a failure, and taht the computation processes elements 'exactly once. (These guarantees
+    naturally assume that Kafka itself does not loose any data.)
+
+    Please note that Flink snapshots the offsets internally as part of its distributed checkpoints.
+    The offsets committed to Kafka / Zookeeper are only to bring the outside view of progress in
+    sync with Flink's view of the progress. That way, monitoring and other jobs can get a view of
+    how far the Flink Kafka consumer has consumed a topic.
+
+    Please refer to Kafka's documentation for the available configuration properties:
+    http://kafka.apache.org/documentation.html#newconsumerconfigs
+    """
+
+    def __init__(self, topics: Union[str, List[str]], deserialization_schema: DeserializationSchema,
+                 properties: Dict):
+        """
+        Creates a new Kafka streaming source consumer for Kafka 0.10.x.
+
+        This constructor allows passing multiple topics to the consumer.
+
+        :param topics: The Kafka topics to read from.
+        :param deserialization_schema: The de-/serializer used to convert between Kafka's byte
+                                       messages and Flink's objects.
+        :param properties: The properties that are used to configure both the fetcher and the offset
+                           handler.
+        """
+        if not isinstance(topics, list):
+            topics = [topics]
+        gateway = get_gateway()
+        j_properties = gateway.jvm.java.util.Properties()
+        for key, value in properties.items():
+            j_properties.setProperty(key, value)
+
+        JFlinkKafkaConsumer = gateway.jvm \
+            .org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer
+        j_flink_kafka_consumer = \
+            JFlinkKafkaConsumer(topics,
+                                deserialization_schema._j_deserialization_schema,
+                                j_properties)
+        super(FlinkKafkaConsumer, self).__init__(
+            j_flink_kafka_consumer=j_flink_kafka_consumer)
+
+
+class FlinkKafkaProducerBase(SinkFunction):
+    """
+    Flink Sink to produce data into a Kafka topic.
+
+    Please note that this producer provides at-least-once reliability guarantees when checkpoints
+    are enabled and set_flush_on_checkpoint(True) is set. Otherwise, the producer doesn;t provid any
+    reliability guarantees.
+    """
+
+    def __init__(self, j_flink_kafka_producer):
+        super(FlinkKafkaProducerBase, self).__init__(sink_func=j_flink_kafka_producer)
+
+    def set_log_failures_only(self, log_failures_only: bool):
+        """
+        Defines whether the producer should fail on errors, or only log them. If this is set to
+        true, then exceptions will be only logged, if set to false, exceptions will be eventually
+        thrown and cause the streaming program to fail (and enter recovery).
+
+        :param log_failures_only: The flag to indicate logging-only on exceptions.
+        """
+        self._j_function.setLogFailuresOnly(log_failures_only)
+
+    def set_flush_on_checkpoint(self, flush_on_checkpoint: bool):
+        """
+        If set to true, the Flink producer will wait for all outstanding messages in the Kafka
+        buffers to be acknowledged by the Kafka producer on a checkpoint.
+
+        This way, the producer can guarantee that messages in the Kafka buffers are part of the
+        checkpoint.
+
+        :param flush_on_checkpoint: Flag indicating the flush mode (true = flush on checkpoint)
+        """
+        self._j_function.setFlushOnCheckpoint(flush_on_checkpoint)
+
+
+class FlinkKafkaProducer010(FlinkKafkaProducerBase):
+    """
+    Flink Sink to produce data into a Kafka topic. This producer is compatible with Kafka 0.10.x.
+    """
+
+    def __init__(self, topic: str, serialization_schema: SerializationSchema,
+                 producer_config: Dict):
+        """
+        Creates a FlinkKafkaProducer for a given topic. The sink produces a DataStream to the topic.
+
+        Using this constructor, the default FlinkFixedPartitioner will be used as the partitioner.
+        This default partitioner maps each sink subtask to a single Kafka partition (i.e. all
+        records received by a sink subtask will end up in the same Kafka partition).
+
+        :param topic: ID of the Kafka topic.
+        :param serialization_schema: User defined key-less serialization schema.
+        :param producer_config: Properties with the producer configuration.
+        """
+        gateway = get_gateway()
+        j_properties = gateway.jvm.java.util.Properties()
+        for key, value in producer_config.items():
+            j_properties.setProperty(key, value)
+
+        JFlinkKafkaProducer010 = gateway.jvm \
+            .org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer010
+        j_flink_kafka_producer = JFlinkKafkaProducer010(
+            topic, serialization_schema._j_serialization_schema, j_properties)
+        super(FlinkKafkaProducer010, self).__init__(j_flink_kafka_producer=j_flink_kafka_producer)
+
+    def set_write_timestamp_to_kafka(self, write_timestamp_to_kafka: bool):

Review comment:
       Why not put this method into the base class?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #13161: [FLINK-18886][python] Support Kafka connectors for Python DataStream …

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13161:
URL: https://github.com/apache/flink/pull/13161#issuecomment-674488916


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "5195ef99046f3b16c83107f1dc35569ee8942347",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5560",
       "triggerID" : "5195ef99046f3b16c83107f1dc35569ee8942347",
       "triggerType" : "PUSH"
     }, {
       "hash" : "300e5ccc623a584546e60dfbaf8f23c69f726838",
       "status" : "CANCELED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5602",
       "triggerID" : "300e5ccc623a584546e60dfbaf8f23c69f726838",
       "triggerType" : "PUSH"
     }, {
       "hash" : "4fd43cac2195bf69302087ed5a88249dc57b7dd5",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5616",
       "triggerID" : "4fd43cac2195bf69302087ed5a88249dc57b7dd5",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 300e5ccc623a584546e60dfbaf8f23c69f726838 Azure: [CANCELED](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5602) 
   * 4fd43cac2195bf69302087ed5a88249dc57b7dd5 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5616) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #13161: [FLINK-18886][python] Support Kafka connectors for Python DataStream …

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13161:
URL: https://github.com/apache/flink/pull/13161#issuecomment-674488916


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "5195ef99046f3b16c83107f1dc35569ee8942347",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5560",
       "triggerID" : "5195ef99046f3b16c83107f1dc35569ee8942347",
       "triggerType" : "PUSH"
     }, {
       "hash" : "300e5ccc623a584546e60dfbaf8f23c69f726838",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5602",
       "triggerID" : "300e5ccc623a584546e60dfbaf8f23c69f726838",
       "triggerType" : "PUSH"
     }, {
       "hash" : "4fd43cac2195bf69302087ed5a88249dc57b7dd5",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5616",
       "triggerID" : "4fd43cac2195bf69302087ed5a88249dc57b7dd5",
       "triggerType" : "PUSH"
     }, {
       "hash" : "ac58820e47017cd8c7b1a4345f167d7f78c703ab",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5620",
       "triggerID" : "ac58820e47017cd8c7b1a4345f167d7f78c703ab",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * ac58820e47017cd8c7b1a4345f167d7f78c703ab Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5620) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] hequn8128 commented on a change in pull request #13161: [FLINK-18886][python] Support Kafka connectors for Python DataStream …

Posted by GitBox <gi...@apache.org>.
hequn8128 commented on a change in pull request #13161:
URL: https://github.com/apache/flink/pull/13161#discussion_r471483385



##########
File path: flink-python/pyflink/datastream/connectors.py
##########
@@ -0,0 +1,484 @@
+################################################################################
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################
+import abc
+from typing import Dict, List, Union
+
+from pyflink.common import typeinfo
+from pyflink.common.serialization_schemas import DeserializationSchema, SerializationSchema
+from pyflink.datastream.functions import SourceFunction, SinkFunction
+from pyflink.java_gateway import get_gateway
+
+
+class FlinkKafkaConsumerBase(SourceFunction, abc.ABC):
+    """
+    Base class of all Flink Kafka Consumer data sources. This implements the common behavior across
+    all kafka versions.
+
+    The Kafka version specific behavior is defined mainly in the specific subclasses.
+    """
+
+    def __init__(self, j_flink_kafka_consumer):
+        super(FlinkKafkaConsumerBase, self).__init__(source_func=j_flink_kafka_consumer)
+
+    def set_commit_offsets_on_checkpoints(self, commit_on_checkpoints: bool):
+        """
+        Specifies whether or not the consumer should commit offsets back to kafka on checkpoints.
+        This setting will only have effect if checkpointing is enabled for the job. If checkpointing
+        isn't enabled, only the "auto.commit.enable" (for 0.8) / "enable.auto.commit" (for 0.9+)
+        property settings will be used.
+        """
+        self._j_function = self._j_function \
+            .setCommitOffsetsOnCheckpoints(commit_on_checkpoints)
+        return self
+
+    def set_start_from_earliest(self):
+        """
+        Specifies the consumer to start reading from the earliest offset for all partitions. This
+        lets the consumer ignore any committed group offsets in Zookeeper/ Kafka brokers.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function.setStartFromEarliest()
+        return self
+
+    def set_start_from_latest(self):
+        """
+        Specifies the consuer to start reading from the latest offset for all partitions. This lets
+        the consumer ignore any committed group offsets in Zookeeper / Kafka brokers.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function.setStartFromLatest()
+        return self
+
+    def set_start_from_timestamp(self, startup_offsets_timestamp: int):
+        """
+        Specifies the consumer to start reading partitions from a specified timestamp. The specified
+        timestamp must be before the current timestamp. This lets the consumer ignore any committed
+        group offsets in Zookeeper / Kafka brokers.
+
+        The consumer will look up the earliest offset whose timestamp is greater than or equal to
+        the specific timestamp from Kafka. If there's no such offset, the consumer will use the
+        latest offset to read data from Kafka.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+
+        :param startup_offsets_timestamp: timestamp for the startup offsets, as milliseconds for
+                                          epoch.
+        """
+        self._j_function = self._j_function.setStartFromTimestamp(
+            startup_offsets_timestamp)
+        return self
+
+    def set_start_from_group_offsets(self):
+        """
+        Specifies the consumer to start reading from any committed group offsets found in Zookeeper/
+        Kafka brokers. The 'group.id' property must be set in the configuration properties. If no
+        offset can be found for a partition, the behaviour in 'auto.offset.reset' set in the
+        configuration properties will be used for the partition.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function.setStartFromGroupOffsets()
+        return self
+
+    def disable_filter_restored_partitions_with_subscribed_topics(self):
+        """
+        By default, when restoring from a checkpoint / savepoint, the consumer always ignores
+        restored partitions that are no longer associated with the current specified topics or topic
+        pattern to subscribe to.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function \
+            .disableFilterRestoredPartitionsWithSubscribedTopics()
+        return self
+
+    def get_produced_type(self):
+        return typeinfo._from_java_type(self._j_function.getProducedType())
+
+
+class FlinkKafkaConsumer010(FlinkKafkaConsumerBase):
+    """
+    The Flink Kafka Consumer is a streaming data source that pulls a parallel data stream from
+    Apache Kafka 0.10.x. The consumer can run in multiple parallel instances, each of which will
+    pull data from one or more Kafka partitions.
+
+    The Flink Kafka Consumer participates in checkpointing and guarantees that no data is lost
+    during a failure, and taht the computation processes elements 'exactly once. (These guarantees
+    naturally assume that Kafka itself does not loose any data.)
+
+    Please note that Flink snapshots the offsets internally as part of its distributed checkpoints.
+    The offsets committed to Kafka / Zookeeper are only to bring the outside view of progress in
+    sync with Flink's view of the progress. That way, monitoring and other jobs can get a view of
+    how far the Flink Kafka consumer has consumed a topic.
+
+    Please refer to Kafka's documentation for the available configuration properties:
+    http://kafka.apache.org/documentation.html#newconsumerconfigs
+    """
+
+    def __init__(self, topics: Union[str, List[str]], deserialization_schema: DeserializationSchema,
+                 properties: Dict):
+        """
+        Creates a new Kafka streaming source consumer for Kafka 0.10.x.
+
+        This constructor allows passing multiple topics to the consumer.
+
+        :param topics: The Kafka topics to read from.
+        :param deserialization_schema: The de-/serializer used to convert between Kafka's byte
+                                       messages and Flink's objects.
+        :param properties: The properties that are used to configure both the fetcher and the offset
+                           handler.
+        """
+
+        JFlinkKafkaConsumer010 = get_gateway().jvm \
+            .org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer010
+        j_flink_kafka_consumer_010 = _get_kafka_consumer(topics, properties, deserialization_schema,
+                                                         JFlinkKafkaConsumer010)
+        super(FlinkKafkaConsumer010, self).__init__(
+            j_flink_kafka_consumer=j_flink_kafka_consumer_010)
+
+
+class FlinkKafkaConsumer011(FlinkKafkaConsumerBase):
+    """
+    The Flink Kafka Consumer is a streaming data source that pulls a parallel data stream from
+    Apache Kafka 0.10.x. The consumer can run in multiple parallel instances, each of which will
+    pull data from one or more Kafka partitions.
+
+    The Flink Kafka Consumer participates in checkpointing and guarantees that no data is lost
+    during a failure, and taht the computation processes elements 'exactly once. (These guarantees
+    naturally assume that Kafka itself does not loose any data.)
+
+    Please note that Flink snapshots the offsets internally as part of its distributed checkpoints.
+    The offsets committed to Kafka / Zookeeper are only to bring the outside view of progress in
+    sync with Flink's view of the progress. That way, monitoring and other jobs can get a view of
+    how far the Flink Kafka consumer has consumed a topic.
+
+    Please refer to Kafka's documentation for the available configuration properties:
+    http://kafka.apache.org/documentation.html#newconsumerconfigs
+    """
+
+    def __init__(self, topics: Union[str, List[str]], deserialization_schema: DeserializationSchema,
+                 properties: Dict):
+        """
+        Creates a new Kafka streaming source consumer for Kafka 0.10.x.
+
+        This constructor allows passing multiple topics to the consumer.
+
+        :param topics: The Kafka topics to read from.
+        :param deserialization_schema: The de-/serializer used to convert between Kafka's byte
+                                       messages and Flink's objects.
+        :param properties: The properties that are used to configure both the fetcher and the offset
+                           handler.
+        """
+        JFlinkKafkaConsumer011 = get_gateway().jvm \
+            .org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer011
+        j_flink_kafka_consumer_011 = _get_kafka_consumer(topics, properties, deserialization_schema,
+                                                         JFlinkKafkaConsumer011)
+        super(FlinkKafkaConsumer011, self).__init__(j_flink_kafka_consumer_011)
+
+
+class FlinkKafkaConsumer(FlinkKafkaConsumerBase):
+    """
+    The Flink Kafka Consumer is a streaming data source that pulls a parallel data stream from
+    Apache Kafka 0.10.x. The consumer can run in multiple parallel instances, each of which will
+    pull data from one or more Kafka partitions.
+
+    The Flink Kafka Consumer participates in checkpointing and guarantees that no data is lost
+    during a failure, and taht the computation processes elements 'exactly once. (These guarantees
+    naturally assume that Kafka itself does not loose any data.)
+
+    Please note that Flink snapshots the offsets internally as part of its distributed checkpoints.
+    The offsets committed to Kafka / Zookeeper are only to bring the outside view of progress in
+    sync with Flink's view of the progress. That way, monitoring and other jobs can get a view of
+    how far the Flink Kafka consumer has consumed a topic.
+
+    Please refer to Kafka's documentation for the available configuration properties:
+    http://kafka.apache.org/documentation.html#newconsumerconfigs
+    """
+
+    def __init__(self, topics: Union[str, List[str]], deserialization_schema: DeserializationSchema,
+                 properties: Dict):
+        """
+        Creates a new Kafka streaming source consumer for Kafka 0.10.x.
+
+        This constructor allows passing multiple topics to the consumer.
+
+        :param topics: The Kafka topics to read from.
+        :param deserialization_schema: The de-/serializer used to convert between Kafka's byte
+                                       messages and Flink's objects.
+        :param properties: The properties that are used to configure both the fetcher and the offset
+                           handler.
+        """
+
+        JFlinkKafkaConsumer = get_gateway().jvm \
+            .org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer
+        j_flink_kafka_consumer = _get_kafka_consumer(topics, properties, deserialization_schema,
+                                                     JFlinkKafkaConsumer)
+        super(FlinkKafkaConsumer, self).__init__(j_flink_kafka_consumer=j_flink_kafka_consumer)
+
+
+class FlinkKafkaProducerBase(SinkFunction, abc.ABC):
+    """
+    Flink Sink to produce data into a Kafka topic.
+
+    Please note that this producer provides at-least-once reliability guarantees when checkpoints
+    are enabled and set_flush_on_checkpoint(True) is set. Otherwise, the producer doesn;t provid any
+    reliability guarantees.
+    """
+
+    def __init__(self, j_flink_kafka_producer):
+        super(FlinkKafkaProducerBase, self).__init__(sink_func=j_flink_kafka_producer)
+
+    def set_log_failures_only(self, log_failures_only: bool):
+        """
+        Defines whether the producer should fail on errors, or only log them. If this is set to
+        true, then exceptions will be only logged, if set to false, exceptions will be eventually
+        thrown and cause the streaming program to fail (and enter recovery).
+
+        :param log_failures_only: The flag to indicate logging-only on exceptions.
+        """
+        self._j_function.setLogFailuresOnly(log_failures_only)
+
+    def set_flush_on_checkpoint(self, flush_on_checkpoint: bool):
+        """
+        If set to true, the Flink producer will wait for all outstanding messages in the Kafka
+        buffers to be acknowledged by the Kafka producer on a checkpoint.
+
+        This way, the producer can guarantee that messages in the Kafka buffers are part of the
+        checkpoint.
+
+        :param flush_on_checkpoint: Flag indicating the flush mode (true = flush on checkpoint)
+        """
+        self._j_function.setFlushOnCheckpoint(flush_on_checkpoint)
+
+    def set_write_timestamp_to_kafka(self, write_timestamp_to_kafka: bool):
+        """
+        If set to true, Flink will write the (event time) timestamp attached to each record into
+        Kafka. Timestamps must be positive for Kafka to accept them.
+
+        :param write_timestamp_to_kafka: Flag indicating if Flink's internal timestamps are written
+                                         to Kafka.
+        """
+        self._j_function.setWriteTimestampToKafka(write_timestamp_to_kafka)
+
+
+class FlinkKafkaProducer010(FlinkKafkaProducerBase):
+    """
+    Flink Sink to produce data into a Kafka topic. This producer is compatible with Kafka 0.10.x.
+    """
+
+    def __init__(self, topic: str, serialization_schema: SerializationSchema,
+                 producer_config: Dict):
+        """
+        Creates a FlinkKafkaProducer for a given topic. The sink produces a DataStream to the topic.
+
+        Using this constructor, the default FlinkFixedPartitioner will be used as the partitioner.
+        This default partitioner maps each sink subtask to a single Kafka partition (i.e. all
+        records received by a sink subtask will end up in the same Kafka partition).
+
+        :param topic: ID of the Kafka topic.
+        :param serialization_schema: User defined key-less serialization schema.
+        :param producer_config: Properties with the producer configuration.
+        """
+        gateway = get_gateway()
+        j_properties = gateway.jvm.java.util.Properties()
+        for key, value in producer_config.items():
+            j_properties.setProperty(key, value)
+
+        JFlinkKafkaProducer010 = gateway.jvm \
+            .org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer010
+        j_flink_kafka_producer = JFlinkKafkaProducer010(
+            topic, serialization_schema._j_serialization_schema, j_properties)
+        super(FlinkKafkaProducer010, self).__init__(j_flink_kafka_producer=j_flink_kafka_producer)
+
+
+class Semantic(object):
+    """
+    Semantics that can be chosen.
+    :data: `EXACTLY_ONCE`:
+    The Flink producer will write all messages in a Kafka transaction that will be committed to
+    the Kafka on a checkpoint. In this mode FlinkKafkaProducer011 sets up a pool of
+    FlinkKafkaProducer. Between each checkpoint there is created new Kafka transaction, which is
+    being committed on FlinkKafkaProducer011.notifyCheckpointComplete(long). If checkpoint
+    complete notifications are running late, FlinkKafkaProducer011 can run out of
+    FlinkKafkaProducers in the pool. In that case any subsequent FlinkKafkaProducer011.snapshot-
+    State() requests will fail and the FlinkKafkaProducer011 will keep using the
+    FlinkKafkaProducer from previous checkpoint. To decrease chances of failing checkpoints
+    there are four options:
+        1. decrease number of max concurrent checkpoints
+        2. make checkpoints mre reliable (so that they complete faster)
+        3. increase delay between checkpoints
+        4. increase size of FlinkKafkaProducers pool
+
+    :data: `AT_LEAST_ONCE`:
+    The Flink producer will wait for all outstanding messages in the Kafka buffers to be
+    acknowledged by the Kafka producer on a checkpoint.
+
+    :data: `NONE`:
+    Means that nothing will be guaranteed. Messages can be lost and/or duplicated in case of
+    failure.
+    """
+
+    EXACTLY_ONCE = 0,
+    AT_LEAST_ONCE = 1,
+    NONE = 2
+
+    @staticmethod
+    def _to_j_semantic(semantic, j_semantic):
+        if semantic == Semantic.EXACTLY_ONCE:
+            return j_semantic.EXACTLY_ONCE
+        elif semantic == Semantic.AT_LEAST_ONCE:
+            return j_semantic.AT_LEAST_ONCE
+        elif semantic == Semantic.NONE:
+            return j_semantic.NONE
+        else:
+            raise TypeError("Unsupported semantic: %s, supported semantics are: "
+                            "Semantic.EXACTLY_ONCE, Semantic.AT_LEAST_ONCE, Semantic.NONE"
+                            % semantic)
+
+
+class FlinkKafkaProducer011(FlinkKafkaProducerBase):
+    """
+    Flink Sink to produce data into a Kafka topic. This producer is compatible with Kafka 0.11.x. By
+    default producer will use AT_LEAST_ONCE sematic. Before using EXACTLY_ONCE please refer to
+    Flink's Kafka connector documentation.
+    """
+
+    def __init__(self, topic: str, serialization_schema: SerializationSchema,

Review comment:
       Add `kafka_producer_pool_size` to the constructor so that the API of `FlinkKafkaProducer011` is consistent with `FlinkKafkaProducer`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #13161: [FLINK-18886][python] Support Kafka connectors for Python DataStream …

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13161:
URL: https://github.com/apache/flink/pull/13161#issuecomment-674488916


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "5195ef99046f3b16c83107f1dc35569ee8942347",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5560",
       "triggerID" : "5195ef99046f3b16c83107f1dc35569ee8942347",
       "triggerType" : "PUSH"
     }, {
       "hash" : "300e5ccc623a584546e60dfbaf8f23c69f726838",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5602",
       "triggerID" : "300e5ccc623a584546e60dfbaf8f23c69f726838",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 5195ef99046f3b16c83107f1dc35569ee8942347 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5560) 
   * 300e5ccc623a584546e60dfbaf8f23c69f726838 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5602) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #13161: [FLINK-18886][python] Support Kafka connectors for Python DataStream …

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13161:
URL: https://github.com/apache/flink/pull/13161#issuecomment-674488916


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "5195ef99046f3b16c83107f1dc35569ee8942347",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5560",
       "triggerID" : "5195ef99046f3b16c83107f1dc35569ee8942347",
       "triggerType" : "PUSH"
     }, {
       "hash" : "300e5ccc623a584546e60dfbaf8f23c69f726838",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "300e5ccc623a584546e60dfbaf8f23c69f726838",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 5195ef99046f3b16c83107f1dc35569ee8942347 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5560) 
   * 300e5ccc623a584546e60dfbaf8f23c69f726838 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #13161: [FLINK-18886][python] Support Kafka connectors for Python DataStream …

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13161:
URL: https://github.com/apache/flink/pull/13161#issuecomment-674488916


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "5195ef99046f3b16c83107f1dc35569ee8942347",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5560",
       "triggerID" : "5195ef99046f3b16c83107f1dc35569ee8942347",
       "triggerType" : "PUSH"
     }, {
       "hash" : "300e5ccc623a584546e60dfbaf8f23c69f726838",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5602",
       "triggerID" : "300e5ccc623a584546e60dfbaf8f23c69f726838",
       "triggerType" : "PUSH"
     }, {
       "hash" : "4fd43cac2195bf69302087ed5a88249dc57b7dd5",
       "status" : "CANCELED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5616",
       "triggerID" : "4fd43cac2195bf69302087ed5a88249dc57b7dd5",
       "triggerType" : "PUSH"
     }, {
       "hash" : "ac58820e47017cd8c7b1a4345f167d7f78c703ab",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5620",
       "triggerID" : "ac58820e47017cd8c7b1a4345f167d7f78c703ab",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 4fd43cac2195bf69302087ed5a88249dc57b7dd5 Azure: [CANCELED](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5616) 
   * ac58820e47017cd8c7b1a4345f167d7f78c703ab Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5620) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] hequn8128 commented on a change in pull request #13161: [FLINK-18886][python] Support Kafka connectors for Python DataStream …

Posted by GitBox <gi...@apache.org>.
hequn8128 commented on a change in pull request #13161:
URL: https://github.com/apache/flink/pull/13161#discussion_r471376723



##########
File path: flink-python/pyflink/datastream/connectors.py
##########
@@ -0,0 +1,464 @@
+################################################################################
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################
+import abc
+from typing import Dict, List, Union
+
+from pyflink.common import typeinfo
+from pyflink.common.serialization_schemas import DeserializationSchema, SerializationSchema
+from pyflink.datastream.functions import SourceFunction, SinkFunction
+from pyflink.java_gateway import get_gateway
+
+
+class FlinkKafkaConsumerBase(SourceFunction, abc.ABC):
+    """
+    Base class of all Flink Kafka Consumer data sources. This implements the common behavior across
+    all kafka versions.
+
+    The Kafka version specific behavior is defined mainly in the specific subclasses.
+    """
+
+    def __init__(self, j_flink_kafka_consumer):
+        super(FlinkKafkaConsumerBase, self).__init__(source_func=j_flink_kafka_consumer)
+
+    def set_commit_offsets_on_checkpoints(self, commit_on_checkpoints: bool):
+        """
+        Specifies whether or not the consumer should commit offsets back to kafka on checkpoints.
+        This setting will only have effect if checkpointing is enabled for the job. If checkpointing
+        isn't enabled, only the "auto.commit.enable" (for 0.8) / "enable.auto.commit" (for 0.9+)
+        property settings will be used.
+        """
+        self._j_function = self._j_function \
+            .setCommitOffsetsOnCheckpoints(commit_on_checkpoints)
+        return self
+
+    def set_start_from_earliest(self):
+        """
+        Specifies the consumer to start reading from the earliest offset for all partitions. This
+        lets the consumer ignore any committed group offsets in Zookeeper/ Kafka brokers.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function.setStartFromEarliest()
+        return self
+
+    def set_start_from_latest(self):
+        """
+        Specifies the consuer to start reading from the latest offset for all partitions. This lets
+        the consumer ignore any committed group offsets in Zookeeper / Kafka brokers.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function.setStartFromLatest()
+        return self
+
+    def set_start_from_timestamp(self, startup_offsets_timestamp: int):
+        """
+        Specifies the consumer to start reading partitions from a specified timestamp. The specified
+        timestamp must be before the current timestamp. This lets the consumer ignore any committed
+        group offsets in Zookeeper / Kafka brokers.
+
+        The consumer will look up the earliest offset whose timestamp is greater than or equal to
+        the specific timestamp from Kafka. If there's no such offset, the consumer will use the
+        latest offset to read data from Kafka.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+
+        :param startup_offsets_timestamp: timestamp for the startup offsets, as milliseconds for
+                                          epoch.
+        """
+        self._j_function = self._j_function.setStartFromTimestamp(
+            startup_offsets_timestamp)
+        return self
+
+    def set_start_from_group_offsets(self):
+        """
+        Specifies the consumer to start reading from any committed group offsets found in Zookeeper/
+        Kafka brokers. The 'group.id' property must be set in the configuration properties. If no
+        offset can be found for a partition, the behaviour in 'auto.offset.reset' set in the
+        configuration properties will be used for the partition.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function.setStartFromGroupOffsets()
+        return self
+
+    def disable_filter_restored_partitions_with_subscribed_topics(self):
+        """
+        By default, when restoring from a checkpoint / savepoint, the consumer always ignores
+        restored partitions that are no longer associated with the current specified topics or topic
+        pattern to subscribe to.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function \
+            .disableFilterRestoredPartitionsWithSubscribedTopics()
+        return self
+
+    def get_produced_type(self):
+        return typeinfo._from_java_type(self._j_function.getProducedType())
+
+
+class FlinkKafkaConsumer010(FlinkKafkaConsumerBase):
+    """
+    The Flink Kafka Consumer is a streaming data source that pulls a parallel data stream from
+    Apache Kafka 0.10.x. The consumer can run in multiple parallel instances, each of which will
+    pull data from one or more Kafka partitions.
+
+    The Flink Kafka Consumer participates in checkpointing and guarantees that no data is lost
+    during a failure, and taht the computation processes elements 'exactly once. (These guarantees
+    naturally assume that Kafka itself does not loose any data.)
+
+    Please note that Flink snapshots the offsets internally as part of its distributed checkpoints.
+    The offsets committed to Kafka / Zookeeper are only to bring the outside view of progress in
+    sync with Flink's view of the progress. That way, monitoring and other jobs can get a view of
+    how far the Flink Kafka consumer has consumed a topic.
+
+    Please refer to Kafka's documentation for the available configuration properties:
+    http://kafka.apache.org/documentation.html#newconsumerconfigs
+    """
+
+    def __init__(self, topics: Union[str, List[str]], deserialization_schema: DeserializationSchema,
+                 properties: Dict):
+        """
+        Creates a new Kafka streaming source consumer for Kafka 0.10.x.
+
+        This constructor allows passing multiple topics to the consumer.
+
+        :param topics: The Kafka topics to read from.
+        :param deserialization_schema: The de-/serializer used to convert between Kafka's byte
+                                       messages and Flink's objects.
+        :param properties: The properties that are used to configure both the fetcher and the offset
+                           handler.
+        """
+        if not isinstance(topics, list):
+            topics = [topics]
+        gateway = get_gateway()
+        j_properties = gateway.jvm.java.util.Properties()
+        for key, value in properties.items():
+            j_properties.setProperty(key, value)
+
+        JFlinkKafkaConsumer010 = gateway.jvm \
+            .org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer010
+        j_flink_kafka_consumer_010 = \
+            JFlinkKafkaConsumer010(topics,
+                                   deserialization_schema._j_deserialization_schema,
+                                   j_properties)
+        super(FlinkKafkaConsumer010, self).__init__(
+            j_flink_kafka_consumer=j_flink_kafka_consumer_010)
+
+
+class FlinkKafkaConsumer011(FlinkKafkaConsumerBase):
+    """
+    The Flink Kafka Consumer is a streaming data source that pulls a parallel data stream from
+    Apache Kafka 0.10.x. The consumer can run in multiple parallel instances, each of which will
+    pull data from one or more Kafka partitions.
+
+    The Flink Kafka Consumer participates in checkpointing and guarantees that no data is lost
+    during a failure, and taht the computation processes elements 'exactly once. (These guarantees
+    naturally assume that Kafka itself does not loose any data.)
+
+    Please note that Flink snapshots the offsets internally as part of its distributed checkpoints.
+    The offsets committed to Kafka / Zookeeper are only to bring the outside view of progress in
+    sync with Flink's view of the progress. That way, monitoring and other jobs can get a view of
+    how far the Flink Kafka consumer has consumed a topic.
+
+    Please refer to Kafka's documentation for the available configuration properties:
+    http://kafka.apache.org/documentation.html#newconsumerconfigs
+    """
+
+    def __init__(self, topics: Union[str, List[str]], deserialization_schema: DeserializationSchema,
+                 properties: Dict):
+        """
+        Creates a new Kafka streaming source consumer for Kafka 0.10.x.
+
+        This constructor allows passing multiple topics to the consumer.
+
+        :param topics: The Kafka topics to read from.
+        :param deserialization_schema: The de-/serializer used to convert between Kafka's byte
+                                       messages and Flink's objects.
+        :param properties: The properties that are used to configure both the fetcher and the offset
+                           handler.
+        """
+        if not isinstance(topics, list):
+            topics = [topics]
+        gateway = get_gateway()
+        j_properties = gateway.jvm.java.util.Properties()
+        for key, value in properties.items():
+            j_properties.setProperty(key, value)
+
+        JFlinkKafkaConsumer011 = gateway.jvm \
+            .org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer011
+        j_flink_kafka_consumer_011 = \
+            JFlinkKafkaConsumer011(topics,
+                                   deserialization_schema._j_deserialization_schema,
+                                   j_properties)
+        super(FlinkKafkaConsumer011, self).__init__(j_flink_kafka_consumer_011)
+
+
+class FlinkKafkaConsumer(FlinkKafkaConsumerBase):
+    """
+    The Flink Kafka Consumer is a streaming data source that pulls a parallel data stream from
+    Apache Kafka 0.10.x. The consumer can run in multiple parallel instances, each of which will
+    pull data from one or more Kafka partitions.
+
+    The Flink Kafka Consumer participates in checkpointing and guarantees that no data is lost
+    during a failure, and taht the computation processes elements 'exactly once. (These guarantees
+    naturally assume that Kafka itself does not loose any data.)
+
+    Please note that Flink snapshots the offsets internally as part of its distributed checkpoints.
+    The offsets committed to Kafka / Zookeeper are only to bring the outside view of progress in
+    sync with Flink's view of the progress. That way, monitoring and other jobs can get a view of
+    how far the Flink Kafka consumer has consumed a topic.
+
+    Please refer to Kafka's documentation for the available configuration properties:
+    http://kafka.apache.org/documentation.html#newconsumerconfigs
+    """
+
+    def __init__(self, topics: Union[str, List[str]], deserialization_schema: DeserializationSchema,
+                 properties: Dict):
+        """
+        Creates a new Kafka streaming source consumer for Kafka 0.10.x.
+
+        This constructor allows passing multiple topics to the consumer.
+
+        :param topics: The Kafka topics to read from.
+        :param deserialization_schema: The de-/serializer used to convert between Kafka's byte
+                                       messages and Flink's objects.
+        :param properties: The properties that are used to configure both the fetcher and the offset
+                           handler.
+        """
+        if not isinstance(topics, list):
+            topics = [topics]
+        gateway = get_gateway()
+        j_properties = gateway.jvm.java.util.Properties()
+        for key, value in properties.items():
+            j_properties.setProperty(key, value)
+
+        JFlinkKafkaConsumer = gateway.jvm \
+            .org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer
+        j_flink_kafka_consumer = \
+            JFlinkKafkaConsumer(topics,
+                                deserialization_schema._j_deserialization_schema,
+                                j_properties)
+        super(FlinkKafkaConsumer, self).__init__(
+            j_flink_kafka_consumer=j_flink_kafka_consumer)
+
+
+class FlinkKafkaProducerBase(SinkFunction, abc.ABC):
+    """
+    Flink Sink to produce data into a Kafka topic.
+
+    Please note that this producer provides at-least-once reliability guarantees when checkpoints
+    are enabled and set_flush_on_checkpoint(True) is set. Otherwise, the producer doesn;t provid any
+    reliability guarantees.
+    """
+
+    def __init__(self, j_flink_kafka_producer):
+        super(FlinkKafkaProducerBase, self).__init__(sink_func=j_flink_kafka_producer)
+
+    def set_log_failures_only(self, log_failures_only: bool):
+        """
+        Defines whether the producer should fail on errors, or only log them. If this is set to
+        true, then exceptions will be only logged, if set to false, exceptions will be eventually
+        thrown and cause the streaming program to fail (and enter recovery).
+
+        :param log_failures_only: The flag to indicate logging-only on exceptions.
+        """
+        self._j_function.setLogFailuresOnly(log_failures_only)
+
+    def set_flush_on_checkpoint(self, flush_on_checkpoint: bool):
+        """
+        If set to true, the Flink producer will wait for all outstanding messages in the Kafka
+        buffers to be acknowledged by the Kafka producer on a checkpoint.
+
+        This way, the producer can guarantee that messages in the Kafka buffers are part of the
+        checkpoint.
+
+        :param flush_on_checkpoint: Flag indicating the flush mode (true = flush on checkpoint)
+        """
+        self._j_function.setFlushOnCheckpoint(flush_on_checkpoint)
+
+    def set_write_timestamp_to_kafka(self, write_timestamp_to_kafka: bool):
+        """
+        If set to true, Flink will write the (event time) timestamp attached to each record into
+        Kafka. Timestamps must be positive for Kafka to accept them.
+
+        :param write_timestamp_to_kafka: Flag indicating if Flink's internal timestamps are written
+                                         to Kafka.
+        """
+        self._j_function.setWriteTimestampToKafka(write_timestamp_to_kafka)
+
+
+class FlinkKafkaProducer010(FlinkKafkaProducerBase):
+    """
+    Flink Sink to produce data into a Kafka topic. This producer is compatible with Kafka 0.10.x.
+    """
+
+    def __init__(self, topic: str, serialization_schema: SerializationSchema,
+                 producer_config: Dict):
+        """
+        Creates a FlinkKafkaProducer for a given topic. The sink produces a DataStream to the topic.
+
+        Using this constructor, the default FlinkFixedPartitioner will be used as the partitioner.
+        This default partitioner maps each sink subtask to a single Kafka partition (i.e. all
+        records received by a sink subtask will end up in the same Kafka partition).
+
+        :param topic: ID of the Kafka topic.
+        :param serialization_schema: User defined key-less serialization schema.
+        :param producer_config: Properties with the producer configuration.
+        """
+        gateway = get_gateway()
+        j_properties = gateway.jvm.java.util.Properties()
+        for key, value in producer_config.items():
+            j_properties.setProperty(key, value)
+
+        JFlinkKafkaProducer010 = gateway.jvm \
+            .org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer010
+        j_flink_kafka_producer = JFlinkKafkaProducer010(
+            topic, serialization_schema._j_serialization_schema, j_properties)
+        super(FlinkKafkaProducer010, self).__init__(j_flink_kafka_producer=j_flink_kafka_producer)
+
+
+class Semantic(object):
+    """
+    Semantics that can be chosen.
+    :data: `EXACTLY_ONCE`:
+    The Flink producer will write all messages in a Kafka transaction that will be committed to
+    the Kafka on a checkpoint. In this mode FlinkKafkaProducer011 sets up a pool of
+    FlinkKafkaProducer. Between each checkpoint there is created new Kafka transaction, which is
+    being committed on FlinkKafkaProducer011.notifyCheckpointComplete(long). If checkpoint
+    complete notifications are running late, FlinkKafkaProducer011 can run out of
+    FlinkKafkaProducers in the pool. In that case any subsequent FlinkKafkaProducer011.snapshot-
+    State() requests will fail and the FlinkKafkaProducer011 will keep using the
+    FlinkKafkaProducer from previous checkpoint. To decrease chances of failing checkpoints
+    there are four options:
+        1. decrease number of max concurrent checkpoints
+        2. make checkpoints mre reliable (so that they complete faster)
+        3. increase delay between checkpoints
+        4. increase size of FlinkKafkaProducers pool
+
+    :data: `AT_LEAST_ONCE`:
+    The Flink producer will wait for all outstanding messages in the Kafka buffers to be
+    acknowledged by the Kafka producer on a checkpoint.
+
+    :data: `NONE`:
+    Means that nothing will be guaranteed. Messages can be lost and/or duplicated in case of
+    failure.
+    """
+
+    EXACTLY_ONCE = 0,
+    AT_LEAST_ONCE = 1,
+    NONE = 2
+
+    @staticmethod
+    def _to_j_semantic(semantic, j_semantic):
+        if semantic == Semantic.EXACTLY_ONCE:
+            return j_semantic.EXACTLY_ONCE
+        elif semantic == Semantic.AT_LEAST_ONCE:
+            return j_semantic.AT_LEAST_ONCE
+        elif semantic == Semantic.NONE:
+            return j_semantic.NONE
+        else:
+            raise TypeError("Unsupported semantic: %s, supported semantics are: "
+                            "Semantic.EXACTLY_ONCE, Semantic.AT_LEAST_ONCE, Semantic.NONE"
+                            % semantic)
+
+
+class FlinkKafkaProducer011(FlinkKafkaProducerBase):

Review comment:
       add `ignore_failures_after_transaction_timeout` in `FlinkKafkaProducer011 ` and `FlinkKafkaProducer `

##########
File path: flink-python/pyflink/datastream/connectors.py
##########
@@ -0,0 +1,464 @@
+################################################################################
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################
+import abc
+from typing import Dict, List, Union
+
+from pyflink.common import typeinfo
+from pyflink.common.serialization_schemas import DeserializationSchema, SerializationSchema
+from pyflink.datastream.functions import SourceFunction, SinkFunction
+from pyflink.java_gateway import get_gateway
+
+
+class FlinkKafkaConsumerBase(SourceFunction, abc.ABC):
+    """
+    Base class of all Flink Kafka Consumer data sources. This implements the common behavior across
+    all kafka versions.
+
+    The Kafka version specific behavior is defined mainly in the specific subclasses.
+    """
+
+    def __init__(self, j_flink_kafka_consumer):
+        super(FlinkKafkaConsumerBase, self).__init__(source_func=j_flink_kafka_consumer)
+
+    def set_commit_offsets_on_checkpoints(self, commit_on_checkpoints: bool):
+        """
+        Specifies whether or not the consumer should commit offsets back to kafka on checkpoints.
+        This setting will only have effect if checkpointing is enabled for the job. If checkpointing
+        isn't enabled, only the "auto.commit.enable" (for 0.8) / "enable.auto.commit" (for 0.9+)
+        property settings will be used.
+        """
+        self._j_function = self._j_function \
+            .setCommitOffsetsOnCheckpoints(commit_on_checkpoints)
+        return self
+
+    def set_start_from_earliest(self):
+        """
+        Specifies the consumer to start reading from the earliest offset for all partitions. This
+        lets the consumer ignore any committed group offsets in Zookeeper/ Kafka brokers.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function.setStartFromEarliest()
+        return self
+
+    def set_start_from_latest(self):
+        """
+        Specifies the consuer to start reading from the latest offset for all partitions. This lets
+        the consumer ignore any committed group offsets in Zookeeper / Kafka brokers.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function.setStartFromLatest()
+        return self
+
+    def set_start_from_timestamp(self, startup_offsets_timestamp: int):
+        """
+        Specifies the consumer to start reading partitions from a specified timestamp. The specified
+        timestamp must be before the current timestamp. This lets the consumer ignore any committed
+        group offsets in Zookeeper / Kafka brokers.
+
+        The consumer will look up the earliest offset whose timestamp is greater than or equal to
+        the specific timestamp from Kafka. If there's no such offset, the consumer will use the
+        latest offset to read data from Kafka.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+
+        :param startup_offsets_timestamp: timestamp for the startup offsets, as milliseconds for
+                                          epoch.
+        """
+        self._j_function = self._j_function.setStartFromTimestamp(
+            startup_offsets_timestamp)
+        return self
+
+    def set_start_from_group_offsets(self):
+        """
+        Specifies the consumer to start reading from any committed group offsets found in Zookeeper/
+        Kafka brokers. The 'group.id' property must be set in the configuration properties. If no
+        offset can be found for a partition, the behaviour in 'auto.offset.reset' set in the
+        configuration properties will be used for the partition.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function.setStartFromGroupOffsets()
+        return self
+
+    def disable_filter_restored_partitions_with_subscribed_topics(self):
+        """
+        By default, when restoring from a checkpoint / savepoint, the consumer always ignores
+        restored partitions that are no longer associated with the current specified topics or topic
+        pattern to subscribe to.
+
+        This method does not affect where partitions are read from when the consumer is restored
+        from a checkpoint or savepoint. When the consumer is restored from a checkpoint or
+        savepoint, only the offsets in the restored state will be used.
+        """
+        self._j_function = self._j_function \
+            .disableFilterRestoredPartitionsWithSubscribedTopics()
+        return self
+
+    def get_produced_type(self):
+        return typeinfo._from_java_type(self._j_function.getProducedType())
+
+
+class FlinkKafkaConsumer010(FlinkKafkaConsumerBase):
+    """
+    The Flink Kafka Consumer is a streaming data source that pulls a parallel data stream from
+    Apache Kafka 0.10.x. The consumer can run in multiple parallel instances, each of which will
+    pull data from one or more Kafka partitions.
+
+    The Flink Kafka Consumer participates in checkpointing and guarantees that no data is lost
+    during a failure, and taht the computation processes elements 'exactly once. (These guarantees
+    naturally assume that Kafka itself does not loose any data.)
+
+    Please note that Flink snapshots the offsets internally as part of its distributed checkpoints.
+    The offsets committed to Kafka / Zookeeper are only to bring the outside view of progress in
+    sync with Flink's view of the progress. That way, monitoring and other jobs can get a view of
+    how far the Flink Kafka consumer has consumed a topic.
+
+    Please refer to Kafka's documentation for the available configuration properties:
+    http://kafka.apache.org/documentation.html#newconsumerconfigs
+    """
+
+    def __init__(self, topics: Union[str, List[str]], deserialization_schema: DeserializationSchema,
+                 properties: Dict):
+        """
+        Creates a new Kafka streaming source consumer for Kafka 0.10.x.
+
+        This constructor allows passing multiple topics to the consumer.
+
+        :param topics: The Kafka topics to read from.
+        :param deserialization_schema: The de-/serializer used to convert between Kafka's byte
+                                       messages and Flink's objects.
+        :param properties: The properties that are used to configure both the fetcher and the offset
+                           handler.
+        """
+        if not isinstance(topics, list):
+            topics = [topics]
+        gateway = get_gateway()
+        j_properties = gateway.jvm.java.util.Properties()
+        for key, value in properties.items():
+            j_properties.setProperty(key, value)
+
+        JFlinkKafkaConsumer010 = gateway.jvm \
+            .org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer010
+        j_flink_kafka_consumer_010 = \
+            JFlinkKafkaConsumer010(topics,
+                                   deserialization_schema._j_deserialization_schema,
+                                   j_properties)

Review comment:
       Reuse these logics. We can extract a method here.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot commented on pull request #13161: [FLINK-18886][python] Support Kafka connectors for Python DataStream …

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #13161:
URL: https://github.com/apache/flink/pull/13161#issuecomment-674488916


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "5195ef99046f3b16c83107f1dc35569ee8942347",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "5195ef99046f3b16c83107f1dc35569ee8942347",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 5195ef99046f3b16c83107f1dc35569ee8942347 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #13161: [FLINK-18886][python] Support Kafka connectors for Python DataStream …

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13161:
URL: https://github.com/apache/flink/pull/13161#issuecomment-674488916


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "5195ef99046f3b16c83107f1dc35569ee8942347",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5560",
       "triggerID" : "5195ef99046f3b16c83107f1dc35569ee8942347",
       "triggerType" : "PUSH"
     }, {
       "hash" : "300e5ccc623a584546e60dfbaf8f23c69f726838",
       "status" : "CANCELED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5602",
       "triggerID" : "300e5ccc623a584546e60dfbaf8f23c69f726838",
       "triggerType" : "PUSH"
     }, {
       "hash" : "4fd43cac2195bf69302087ed5a88249dc57b7dd5",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5616",
       "triggerID" : "4fd43cac2195bf69302087ed5a88249dc57b7dd5",
       "triggerType" : "PUSH"
     }, {
       "hash" : "ac58820e47017cd8c7b1a4345f167d7f78c703ab",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5620",
       "triggerID" : "ac58820e47017cd8c7b1a4345f167d7f78c703ab",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 300e5ccc623a584546e60dfbaf8f23c69f726838 Azure: [CANCELED](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5602) 
   * 4fd43cac2195bf69302087ed5a88249dc57b7dd5 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5616) 
   * ac58820e47017cd8c7b1a4345f167d7f78c703ab Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5620) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] hequn8128 merged pull request #13161: [FLINK-18886][python] Support Kafka connectors for Python DataStream …

Posted by GitBox <gi...@apache.org>.
hequn8128 merged pull request #13161:
URL: https://github.com/apache/flink/pull/13161


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot commented on pull request #13161: [FLINK-18886][python] Support Kafka connectors for Python DataStream …

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #13161:
URL: https://github.com/apache/flink/pull/13161#issuecomment-674487597


   Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
   to review your pull request. We will use this comment to track the progress of the review.
   
   
   ## Automated Checks
   Last check on commit 5195ef99046f3b16c83107f1dc35569ee8942347 (Sun Aug 16 06:45:50 UTC 2020)
   
   **Warnings:**
    * No documentation files were touched! Remember to keep the Flink docs up to date!
   
   
   <sub>Mention the bot in a comment to re-run the automated checks.</sub>
   ## Review Progress
   
   * ❓ 1. The [description] looks good.
   * ❓ 2. There is [consensus] that the contribution should go into to Flink.
   * ❓ 3. Needs [attention] from.
   * ❓ 4. The change fits into the overall [architecture].
   * ❓ 5. Overall code [quality] is good.
   
   Please see the [Pull Request Review Guide](https://flink.apache.org/contributing/reviewing-prs.html) for a full explanation of the review process.<details>
    The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot approve description` to approve one or more aspects (aspects: `description`, `consensus`, `architecture` and `quality`)
    - `@flinkbot approve all` to approve all aspects
    - `@flinkbot approve-until architecture` to approve everything until `architecture`
    - `@flinkbot attention @username1 [@username2 ..]` to require somebody's attention
    - `@flinkbot disapprove architecture` to remove an approval you gave earlier
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org