private void processStreamsPartitionAssignment(final org.apache.kafka.streams.processor.assignment.TaskAssignor assignor,
                                                   final TaskAssignment taskAssignment,
                                                   final AssignmentError assignmentError,
                                                   final Map<ProcessId, ClientMetadata> clientMetadataMap,
                                                   final GroupSubscription groupSubscription) {
        if (assignmentError == AssignmentError.UNKNOWN_PROCESS_ID || assignmentError == AssignmentError.UNKNOWN_TASK_ID) {
            assignor.onAssignmentComputed(new GroupAssignment(Collections.emptyMap()), groupSubscription, assignmentError);
            log.error("Rebalance failed due to task assignor returning assignment with error {}, " +
                      "assignor callback will receive empty GroupAssignment due to this error", assignmentError);
            throw new StreamsException("Task assignment with " + assignor.getClass().getName() +
                                       " returned a fatal error: " + assignmentError);
        }

        taskAssignment.assignment().forEach(kafkaStreamsAssignment -> {
            final ProcessId processId = kafkaStreamsAssignment.processId();
            final ClientMetadata clientMetadata = clientMetadataMap.get(processId);
            clientMetadata.state.setAssignedTasks(kafkaStreamsAssignment);
            if (kafkaStreamsAssignment.followupRebalanceDeadline().isPresent()) {
                clientMetadata.state.setFollowupRebalanceDeadline(kafkaStreamsAssignment.followupRebalanceDeadline().get());
            }
        });
    }
@param clientMetadataMap the map of process id to client metadata used to build an immutable
                         {@code ApplicationState}
@return The {@code ApplicationState} needed by the TaskAssigner to compute new task
        assignments.
streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamsPartitionAssignor.java