@Override
    public List<TaskModel> getMappedTasks(TaskMapperContext taskMapperContext)
            throws TerminateWorkflowException {

        LOGGER.debug("TaskMapperContext {} in KafkaPublishTaskMapper", taskMapperContext);

        WorkflowTask workflowTask = taskMapperContext.getWorkflowTask();
        WorkflowModel workflowModel = taskMapperContext.getWorkflowModel();
        String taskId = taskMapperContext.getTaskId();
        int retryCount = taskMapperContext.getRetryCount();

        TaskDef taskDefinition =
                Optional.ofNullable(taskMapperContext.getTaskDefinition())
                        .orElseGet(() -> metadataDAO.getTaskDef(workflowTask.getName()));

        Map<String, Object> input =
                parametersUtils.getTaskInputV2(
                        workflowTask.getInputParameters(), workflowModel, taskId, taskDefinition);

        TaskModel kafkaPublishTask = taskMapperContext.createTaskModel();
        kafkaPublishTask.setInputData(input);
        kafkaPublishTask.setStatus(TaskModel.Status.SCHEDULED);
        kafkaPublishTask.setRetryCount(retryCount);
        kafkaPublishTask.setCallbackAfterSeconds(workflowTask.getStartDelay());
        if (Objects.nonNull(taskDefinition)) {
            kafkaPublishTask.setExecutionNameSpace(taskDefinition.getExecutionNameSpace());
            kafkaPublishTask.setIsolationGroupId(taskDefinition.getIsolationGroupId());
            kafkaPublishTask.setRateLimitPerFrequency(taskDefinition.getRateLimitPerFrequency());
            kafkaPublishTask.setRateLimitFrequencyInSeconds(
                    taskDefinition.getRateLimitFrequencyInSeconds());
        }
        return Collections.singletonList(kafkaPublishTask);
    }
This method maps a {@link WorkflowTask} of type {@link TaskType#KAFKA_PUBLISH} to a {@link
TaskModel} in a {@link TaskModel.Status#SCHEDULED} state

@param taskMapperContext: A wrapper class containing the {@link WorkflowTask}, {@link
    WorkflowDef}, {@link WorkflowModel} and a string representation of the TaskId
@return a List with just one Kafka task
@throws TerminateWorkflowException In case if the task definition does not exist
core/src/main/java/com/netflix/conductor/core/execution/mapper/KafkaPublishTaskMapper.java