You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/08/15 13:54:00 UTC
[jira] [Commented] (FLINK-8290) Allow setting clientId in
flink-connector-kafka-0.8
[ https://issues.apache.org/jira/browse/FLINK-8290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16581098#comment-16581098 ]
ASF GitHub Bot commented on FLINK-8290:
---------------------------------------
aljoscha closed pull request #5304: [FLINK-8290]Modify clientId to groupId in flink-connector-kafka-0.8
URL: https://github.com/apache/flink/pull/5304
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/flink-connectors/flink-connector-kafka-0.8/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/SimpleConsumerThread.java b/flink-connectors/flink-connector-kafka-0.8/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/SimpleConsumerThread.java
index 4c704c3b81c..1fdff9d9c8d 100644
--- a/flink-connectors/flink-connector-kafka-0.8/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/SimpleConsumerThread.java
+++ b/flink-connectors/flink-connector-kafka-0.8/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/SimpleConsumerThread.java
@@ -94,6 +94,7 @@
private final int fetchSize;
private final int bufferSize;
private final int reconnectLimit;
+ private final String clientId;
// exceptions are thrown locally
public SimpleConsumerThread(
@@ -123,6 +124,8 @@ public SimpleConsumerThread(
this.fetchSize = getInt(config, "fetch.message.max.bytes", 1048576);
this.bufferSize = getInt(config, "socket.receive.buffer.bytes", 65536);
this.reconnectLimit = getInt(config, "flink.simple-consumer-reconnectLimit", 3);
+ String groupId = config.getProperty("group.id", "flink-kafka-consumer-legacy-" + broker.id());
+ this.clientId = config.getProperty("client.id", groupId);
}
public ClosableBlockingQueue<KafkaTopicPartitionState<TopicAndPartition>> getNewPartitionsQueue() {
@@ -138,8 +141,6 @@ public void run() {
LOG.info("Starting to fetch from {}", this.partitions);
// set up the config values
- final String clientId = "flink-kafka-consumer-legacy-" + broker.id();
-
try {
// create the Kafka consumer that we actually use for fetching
consumer = new SimpleConsumer(broker.host(), broker.port(), soTimeout, bufferSize, clientId);
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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
> Allow setting clientId in flink-connector-kafka-0.8
> ---------------------------------------------------
>
> Key: FLINK-8290
> URL: https://issues.apache.org/jira/browse/FLINK-8290
> Project: Flink
> Issue Type: Improvement
> Reporter: xymaqingxiang
> Assignee: xymaqingxiang
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.7.0
>
>
> Now the Clientid that consumes the all topics are constant("flink-kafka-consumer-legacy-" + broker.id()), and it is not easy for us to look at kafka's log, so I recommend that it be modified to groupid.
> We can modify the SimpleConsumerThread.java file, as shown below:
> {code:java}
> private final String clientId;
> ...
> this.clientId = config.getProperty("group.id", "flink-kafka-consumer-legacy-" + broker.id());
> ...
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)