use of com.netflix.conductor.util.Constants.PAYLOAD_KEY in project conductor by Netflix.
the class CassandraExecutionDAO method getTask.
@Override
public Task getTask(String taskId) {
try {
String workflowId = lookupWorkflowIdFromTaskId(taskId);
if (workflowId == null) {
return null;
}
// TODO: implement for query against multiple shards
ResultSet resultSet = session.execute(selectTaskStatement.bind(UUID.fromString(workflowId), DEFAULT_SHARD_ID, taskId));
return Optional.ofNullable(resultSet.one()).map(row -> {
Task task = readValue(row.getString(PAYLOAD_KEY), Task.class);
recordCassandraDaoRequests("getTask", task.getTaskType(), task.getWorkflowType());
recordCassandraDaoPayloadSize("getTask", toJson(task).length(), task.getTaskType(), task.getWorkflowType());
return task;
}).orElse(null);
} catch (ApplicationException ae) {
throw ae;
} catch (Exception e) {
Monitors.error(CLASS_NAME, "getTask");
String errorMsg = String.format("Error getting task by id: %s", taskId);
LOGGER.error(errorMsg, e);
throw new ApplicationException(Code.BACKEND_ERROR, errorMsg);
}
}
Aggregations