dajac commented on code in PR #12845:
URL: https://github.com/apache/kafka/pull/12845#discussion_r1027049080


##########
core/src/main/scala/kafka/server/KafkaApis.scala:
##########
@@ -1647,69 +1656,51 @@ class KafkaApis(val requestChannel: RequestChannel,
     }
   }
 
-  def handleJoinGroupRequest(request: RequestChannel.Request, requestLocal: 
RequestLocal): Unit = {
-    val joinGroupRequest = request.body[JoinGroupRequest]
+  private def makeGroupCoordinatorRequestContext(
+    request: RequestChannel.Request,
+    requestLocal: RequestLocal
+  ): GroupCoordinatorRequestContext = {
+    new GroupCoordinatorRequestContext(
+      request.context.header.data.requestApiVersion,
+      request.context.header.data.clientId,
+      request.context.clientAddress,
+      requestLocal.bufferSupplier
+    )
+  }
 
-    // the callback for sending a join-group response
-    def sendResponseCallback(joinResult: JoinGroupResult): Unit = {
-      def createResponse(requestThrottleMs: Int): AbstractResponse = {
-        val responseBody = new JoinGroupResponse(
-          new JoinGroupResponseData()
-            .setThrottleTimeMs(requestThrottleMs)
-            .setErrorCode(joinResult.error.code)
-            .setGenerationId(joinResult.generationId)
-            .setProtocolType(joinResult.protocolType.orNull)
-            .setProtocolName(joinResult.protocolName.orNull)
-            .setLeader(joinResult.leaderId)
-            .setSkipAssignment(joinResult.skipAssignment)
-            .setMemberId(joinResult.memberId)
-            .setMembers(joinResult.members.asJava),
-          request.context.apiVersion
-        )
+  def handleJoinGroupRequest(
+    request: RequestChannel.Request,
+    requestLocal: RequestLocal
+  ): CompletableFuture[Unit] = {

Review Comment:
   A future is a better abstraction than a callback in my opinion but that is 
subjective. We could keep using callbacks as well. The end result in the same. 
The new Controller interface uses Futures as well so standardizing makes sense 
here.
   
   Regarding the current APIs, join group and sync group are definitely relying 
on callbacks. For the others, I don’t remember from the top of my head. In the 
new group coordinator, all of them will be executed in a different thread so 
they must be async.



-- 
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-unsubscr...@kafka.apache.org

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

Reply via email to