Search in sources :

Example 56 with TaskResult

use of com.netflix.conductor.common.metadata.tasks.TaskResult in project orkesworkers by orkes-io.

the class MapStateCodeWorker method execute.

@Override
public TaskResult execute(Task task) {
    List<Map<String, Object>> statePopulations = (List<Map<String, Object>>) task.getInputData().get("statePopulations");
    statePopulations.forEach(stateData -> {
        String state = (String) stateData.get("State");
        stateData.put("stateCode", Constants.STATE_CODES.getOrDefault(state, "NOT_AVAILABLE"));
    });
    TaskResult result = new TaskResult(task);
    String currentTimeOnServer = Instant.now().toString();
    result.log("Mapped states to codes at " + currentTimeOnServer);
    result.addOutputData("statePopulations", statePopulations);
    result.setStatus(TaskResult.Status.COMPLETED);
    return result;
}
Also used : TaskResult(com.netflix.conductor.common.metadata.tasks.TaskResult) List(java.util.List) Map(java.util.Map)

Example 57 with TaskResult

use of com.netflix.conductor.common.metadata.tasks.TaskResult in project orkesworkers by orkes-io.

the class ReadNameWorker method execute.

@Override
public TaskResult execute(Task task) {
    TaskResult result = new TaskResult(task);
    result.setStatus(TaskResult.Status.COMPLETED);
    return result;
}
Also used : TaskResult(com.netflix.conductor.common.metadata.tasks.TaskResult)

Example 58 with TaskResult

use of com.netflix.conductor.common.metadata.tasks.TaskResult in project orkesworkers by orkes-io.

the class ShippingInfoWorker method execute.

@Override
public TaskResult execute(Task task) {
    TaskResult result = new TaskResult(task);
    result.addOutputData("shipping_service", task.getInputData().get("service"));
    result.log("Shipped order reference id : " + UUID.randomUUID());
    result.setStatus(TaskResult.Status.COMPLETED);
    return result;
}
Also used : TaskResult(com.netflix.conductor.common.metadata.tasks.TaskResult)

Example 59 with TaskResult

use of com.netflix.conductor.common.metadata.tasks.TaskResult in project orkesworkers by orkes-io.

the class Task10Worker method execute.

@Override
public TaskResult execute(Task task) {
    TaskResult result = new TaskResult(task);
    result.setStatus(TaskResult.Status.COMPLETED);
    return result;
}
Also used : TaskResult(com.netflix.conductor.common.metadata.tasks.TaskResult)

Example 60 with TaskResult

use of com.netflix.conductor.common.metadata.tasks.TaskResult in project orkesworkers by orkes-io.

the class HelloWorld method execute.

@Override
public TaskResult execute(Task task) {
    TaskResult result = new TaskResult(task);
    result.addOutputData("hw_response", "Hello World!");
    result.setStatus(TaskResult.Status.COMPLETED);
    return result;
}
Also used : TaskResult(com.netflix.conductor.common.metadata.tasks.TaskResult)

Aggregations

TaskResult (com.netflix.conductor.common.metadata.tasks.TaskResult)66 Test (org.junit.Test)29 Task (com.netflix.conductor.common.metadata.tasks.Task)22 Workflow (com.netflix.conductor.common.run.Workflow)17 WorkflowTask (com.netflix.conductor.common.metadata.workflow.WorkflowTask)13 TaskClient (com.netflix.conductor.client.http.TaskClient)11 Worker (com.netflix.conductor.client.worker.Worker)11 CountDownLatch (java.util.concurrent.CountDownLatch)9 SubWorkflow (com.netflix.conductor.core.execution.tasks.SubWorkflow)8 HashMap (java.util.HashMap)8 StartWorkflowRequest (com.netflix.conductor.common.metadata.workflow.StartWorkflowRequest)7 UserTask (com.netflix.conductor.tests.utils.UserTask)7 Map (java.util.Map)7 WorkflowDef (com.netflix.conductor.common.metadata.workflow.WorkflowDef)6 PrintWriter (java.io.PrintWriter)5 StringWriter (java.io.StringWriter)5 List (java.util.List)5 TaskDef (com.netflix.conductor.common.metadata.tasks.TaskDef)4 ApplicationException (com.netflix.conductor.core.execution.ApplicationException)4 TypeReference (com.fasterxml.jackson.core.type.TypeReference)2