Source:
protected void onJoinComplete(int generation, String memberId, String assignmentStrategy, ByteBuffer assignmentBuffer) { if (!isLeader) assignmentSnapshot = null; PartitionAssignor assignor = lookupAssignor(assignmentStrategy); if (assignor == null) throw new IllegalStateException("Coordinator selected invalid assignment protocol: " + assignmentStrategy); Set<TopicPartition> ownedPartitions = new HashSet<>(subscriptions.assignedPartitions()); Assignment assignment = ConsumerProtocol.deserializeAssignment(assignmentBuffer); if (!subscriptions.assignFromSubscribed(assignment.partitions())) { handleAssignmentMismatch(assignment); return; } Set<TopicPartition> assignedPartitions = new HashSet<>(subscriptions.assignedPartitions()); maybeUpdateJoinedSubscription(assignedPartitions); assignor.onAssignment(assignment, generation); if (autoCommitEnabled) this.nextAutoCommitTimer.updateAndReset(autoCommitIntervalMs); ConsumerRebalanceListener listener = subscriptions.rebalanceListener(); switch (protocol) { case EAGER: if (!ownedPartitions.isEmpty()) { log.warn("Some partitions are not revoked with " + protocol + " protocol, " + "it is likely that the previous rebalance did not complete due to some errors"); } log.info("Setting newly assigned partitions: {}", Utils.join(assignedPartitions, ", ")); try { listener.onPartitionsAssigned(assignedPartitions); } catch (WakeupException | InterruptException e) { throw e; } catch (Exception e) { log.error("User provided listener failed on partition assignment", listener.getClass().getName(), e); } break; case COOPERATIVE: assignAndRevoke(listener, assignedPartitions, ownedPartitions); if (assignment.error() == ConsumerProtocol.Errors.NEED_REJOIN) { requestRejoin(); } break; } }

Target:
protected void onJoinComplete(int generation, String memberId, String assignmentStrategy, ByteBuffer assignmentBuffer) { if (!isLeader) assignmentSnapshot = null; PartitionAssignor assignor = lookupAssignor(assignmentStrategy); if (assignor == null) throw new IllegalStateException("Coordinator selected invalid assignment protocol: " + assignmentStrategy); Set<TopicPartition> ownedPartitions = new HashSet<>(subscriptions.assignedPartitions()); Assignment assignment = ConsumerProtocol.deserializeAssignment(assignmentBuffer); if (!subscriptions.assignFromSubscribed(assignment.partitions())) { log.warn("We received an assignment that doesn't match our current subscription {}; it is likely " + "that the subscription has changed since we joined the group. Will try re-join the group with current subscription", assignment.partitions(), subscriptions.prettyString()); requestRejoin(); return; } Set<TopicPartition> assignedPartitions = subscriptions.assignedPartitions(); maybeUpdateJoinedSubscription(assignedPartitions); assignor.onAssignment(assignment, generation); if (autoCommitEnabled) this.nextAutoCommitTimer.updateAndReset(autoCommitIntervalMs); ConsumerRebalanceListener listener = subscriptions.rebalanceListener(); switch (protocol) { case EAGER: if (!ownedPartitions.isEmpty()) { log.info("Coordinator has owned partitions that are not revoked with protocol, " + "it is likely client is woken up before a previous pending rebalance completes its callback", ownedPartitions, protocol); } log.info("Setting newly assigned partitions: {}", Utils.join(assignedPartitions, ", ")); try { listener.onPartitionsAssigned(assignedPartitions); } catch (WakeupException | InterruptException e) { throw e; } catch (Exception e) { log.error("User provided listener failed on partition assignment", listener.getClass().getName(), e); } break; case COOPERATIVE: assignAndRevoke(listener, assignedPartitions, ownedPartitions); if (assignment.error() == ConsumerProtocol.AssignmentError.NEED_REJOIN) { requestRejoin(); } break; } }