private boolean startTask(ConnectorTaskId taskId, Map<String, String> connProps) {
        switch (connectorType(connProps)) {
            case SINK:
                return worker.startSinkTask(
                        taskId,
                        configState,
                        connProps,
                        configState.taskConfig(taskId),
                        this,
                        configState.targetState(taskId.connector())
                );
            case SOURCE:
                return worker.startSourceTask(
                        taskId,
                        configState,
                        connProps,
                        configState.taskConfig(taskId),
                        this,
                        configState.targetState(taskId.connector())
                );
            default:
                throw new ConnectException("Failed to start task " + taskId + " since it is not a recognizable type (source or sink)");
        }
    }
This method performs a few checks for external requests to modify (alter or reset) connector offsets and
completes the callback exceptionally if any check fails.
@param connName the name of the connector whose offsets are to be modified
@param cb callback to invoke upon completion
@return true if all the checks passed, false otherwise
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/standalone/StandaloneHerder.java