JoinGroupResponseHandler

JoinGroupResponseHandler is a concrete CoordinatorResponseHandler to handle a successful JoinGroupResponse from a group coordinator (and convert it to a ByteBuffer).

Note
JoinGroupResponseHandler is a Java private class of AbstractCoordinator and so can only be used by AbstractCoordinators.

JoinGroupResponseHandler is created exclusively when AbstractCoordinator is requested to send a JoinGroupRequest to the group coordinator (when requested to initiateJoinGroup when joinGroupIfNeeded which is when ConsumerCoordinator is requested to poll for coordinator events).

JoinGroupResponseHandler takes no arguments to be created.

Handling Successful Response From Group Coordinator — handle Method

void handle(
  JoinGroupResponse joinResponse,
  RequestFuture<ByteBuffer> future)
Note
handle is part of the CoordinatorResponseHandler Contract to handle a successful response from a group coordinator.

handle branches off per the error in the given JoinGroupResponse.

No Errors

handle prints out the following DEBUG message to the logs:

Received successful JoinGroup response: [joinResponse]

handle requests the GroupCoordinatorMetrics for the joinLatency sensor to record the request latency.

When in REBALANCING state, handle creates a new Generation (with the generation ID, the member ID, and the group protocol from the given JoinGroupResponse).

In the end, handle checks if the given JoinGroupResponse is for the leader of the consumer group or a follower and performs partition assignment and notifies the group coordinator or onJoinFollower, respectively.

When not in REBALANCING state, handle requests the raises the given RequestFuture<ByteBuffer> to raise a UnjoinedGroupException.

Caution
There are other errors, but of little interest currently (aka FIXME).

results matching ""

    No results matching ""