public static TaskId parse(final String taskIdStr) {
        try {
            final int namedTopologyDelimiterIndex = taskIdStr.indexOf(NAMED_TOPOLOGY_DELIMITER);
            // If there is no copy of the NamedTopology delimiter, this task has no named topology and only one `_` char
            if (namedTopologyDelimiterIndex < 0) {
                final int index = taskIdStr.indexOf('_');

                final int topicGroupId = Integer.parseInt(taskIdStr.substring(0, index));
                final int partition = Integer.parseInt(taskIdStr.substring(index + 1));

                return new TaskId(topicGroupId, partition);
            } else {
                final int topicGroupIdIndex = namedTopologyDelimiterIndex + 2;
                final int subtopologyPartitionDelimiterIndex = taskIdStr.indexOf('_', topicGroupIdIndex);

                final String namedTopology = taskIdStr.substring(0, namedTopologyDelimiterIndex);
                final int topicGroupId = Integer.parseInt(taskIdStr.substring(topicGroupIdIndex, subtopologyPartitionDelimiterIndex));
                final int partition = Integer.parseInt(taskIdStr.substring(subtopologyPartitionDelimiterIndex + 1));

                return new TaskId(topicGroupId, partition, namedTopology);
            }
        } catch (final Exception e) {
            throw new TaskIdFormatException(taskIdStr);
        }
    }
@throws TaskIdFormatException if the taskIdStr is not a valid {@link TaskId}
streams/src/main/java/org/apache/kafka/streams/processor/TaskId.java