You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/09/21 20:29:48 UTC

[GitHub] [kafka] philipnee commented on a diff in pull request #12672: KAFKA-14252: Consumer refactor background thread

philipnee commented on code in PR #12672:
URL: https://github.com/apache/kafka/pull/12672#discussion_r976958108


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerBackgroundThread.java:
##########
@@ -0,0 +1,78 @@
+/*
+ * 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.kafka.clients.consumer.internals;
+
+import org.apache.kafka.clients.consumer.internals.events.ConsumerRequestEvent;
+import org.apache.kafka.clients.consumer.internals.events.ConsumerResponseEvent;
+import org.apache.kafka.common.utils.KafkaThread;
+import org.apache.kafka.common.utils.Time;
+
+import java.util.concurrent.BlockingQueue;
+
+/**
+ * The background thread runs in the background and consumes the {@code ApplicationEvent} from the {@link org.apache.kafka.clients.consumer.KafkaConsumer} APIs. This class uses an event loop to drive the following important tasks:
+ * <ul>
+ *  <li>Consuming and executing the {@code ApplicationEvent}.</li>
+ *  <li>Maintaining the connection to the coordinator.</li>
+ *  <li>Sending heartbeat.</li>
+ *  <li>Autocommitting.</li>
+ *  <li>Executing the rebalance flow.</li>
+ * </ul>
+ */
+public class ConsumerBackgroundThread extends KafkaThread implements AutoCloseable {

Review Comment:
   good call, I think probably not? I think we just want to start the thread.  I'm actually not sure why I added that there.



-- 
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.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

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