[ https://issues.apache.org/jira/browse/FLINK-8191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16286776#comment-16286776 ]
ASF GitHub Bot commented on FLINK-8191: --------------------------------------- Github user tzulitai commented on a diff in the pull request: https://github.com/apache/flink/pull/5116#discussion_r156233400 --- Diff: flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/partitioner/FlinkRoundRobinPartitioner.java --- @@ -0,0 +1,72 @@ +/* + * 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. + */ + +package org.apache.flink.streaming.connectors.kafka.partitioner; + +import org.apache.flink.util.Preconditions; + +/** + * A partitioner ensuring that each internal Flink partition communicate with Kafka partition in round robin manner. + * + * <p>Note, one Kafka partition can contain multiple Flink partitions. + * + * <p>Cases: + * # More Flink partitions than kafka partitions + * <pre> + * Flink Sinks: Kafka Partitions + * 1 ----------------> 1 + * 2 --------------/ + * 3 -------------/ + * 4 ------------/ + * </pre> + * Some (or all) kafka partitions contain the output of more than one flink partition + * + * <p>Fewer Flink partitions than Kafka + * <pre> + * Flink Sinks: Kafka Partitions + * 1 ----------------> 1 + * 2 ----------------> 2 + * 3 + * 4 + * 5 + * </pre> + * + * <p>All Kafka partitions contain data + * This is a round-robin kafka partitioner (note that this will + * cause a lot of network connections between all the Flink instances and all the Kafka brokers). + */ +public class FlinkRoundRobinPartitioner<T> extends FlinkKafkaPartitioner<T> { + private int parallelInstanceId; --- End diff -- nit: can we have an empty line before the class fields? Just a matter of taste :) > Add a RoundRobinPartitioner to be shipped with the Kafka connector > ------------------------------------------------------------------ > > Key: FLINK-8191 > URL: https://issues.apache.org/jira/browse/FLINK-8191 > Project: Flink > Issue Type: New Feature > Components: Kafka Connector > Reporter: Tzu-Li (Gordon) Tai > Assignee: Aegeaner > Priority: Blocker > Fix For: 1.5.0 > > > We should perhaps consider adding a round-robin partitioner ready for use to > be shipped with the Kafka connector, along side the already available > {{FlinkFixedPartitioner}}. > See the original discussion here: > http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/FlinkKafkaProducerXX-td16951.html -- This message was sent by Atlassian JIRA (v6.4.14#64029)