Search in sources :

Example 6 with Service

use of com.netflix.conductor.annotations.Service in project conductor by Netflix.

the class WorkflowBulkServiceImpl method restart.

/**
 * Restart the list of workflows.
 *
 * @param workflowIds          - list of workflow Ids  to perform restart operation on
 * @param useLatestDefinitions if true, use latest workflow and task definitions upon restart
 * @return bulk response object containing a list of succeeded workflows and a list of failed ones with errors
 */
@Service
public BulkResponse restart(List<String> workflowIds, boolean useLatestDefinitions) {
    BulkResponse bulkResponse = new BulkResponse();
    for (String workflowId : workflowIds) {
        try {
            workflowExecutor.rewind(workflowId, useLatestDefinitions);
            bulkResponse.appendSuccessResponse(workflowId);
        } catch (Exception e) {
            LOGGER.error("bulk restart exception, workflowId {}, message: {} ", workflowId, e.getMessage(), e);
            bulkResponse.appendFailedResponse(workflowId, e.getMessage());
        }
    }
    return bulkResponse;
}
Also used : BulkResponse(com.netflix.conductor.service.common.BulkResponse) Service(com.netflix.conductor.annotations.Service)

Example 7 with Service

use of com.netflix.conductor.annotations.Service in project conductor by Netflix.

the class WorkflowBulkServiceImpl method retry.

/**
 * Retry the last failed task for each workflow from the list.
 * @param workflowIds - list of workflow Ids  to perform retry operation on
 * @return bulk response object containing a list of succeeded workflows and a list of failed ones with errors
 */
@Service
public BulkResponse retry(List<String> workflowIds) {
    BulkResponse bulkResponse = new BulkResponse();
    for (String workflowId : workflowIds) {
        try {
            workflowExecutor.retry(workflowId, false);
            bulkResponse.appendSuccessResponse(workflowId);
        } catch (Exception e) {
            LOGGER.error("bulk retry exception, workflowId {}, message: {} ", workflowId, e.getMessage(), e);
            bulkResponse.appendFailedResponse(workflowId, e.getMessage());
        }
    }
    return bulkResponse;
}
Also used : BulkResponse(com.netflix.conductor.service.common.BulkResponse) Service(com.netflix.conductor.annotations.Service)

Example 8 with Service

use of com.netflix.conductor.annotations.Service in project conductor by Netflix.

the class WorkflowBulkServiceImpl method terminate.

/**
 * Terminate workflows execution.
 * @param workflowIds - list of workflow Ids  to perform terminate operation on
 * @param reason - description to be specified for the terminated workflow for future references.
 * @return bulk response object containing a list of succeeded workflows and a list of failed ones with errors
 */
@Service
public BulkResponse terminate(List<String> workflowIds, String reason) {
    BulkResponse bulkResponse = new BulkResponse();
    for (String workflowId : workflowIds) {
        try {
            workflowExecutor.terminateWorkflow(workflowId, reason);
            bulkResponse.appendSuccessResponse(workflowId);
        } catch (Exception e) {
            LOGGER.error("bulk terminate exception, workflowId {}, message: {} ", workflowId, e.getMessage(), e);
            bulkResponse.appendFailedResponse(workflowId, e.getMessage());
        }
    }
    return bulkResponse;
}
Also used : BulkResponse(com.netflix.conductor.service.common.BulkResponse) Service(com.netflix.conductor.annotations.Service)

Example 9 with Service

use of com.netflix.conductor.annotations.Service in project conductor by Netflix.

the class WorkflowBulkServiceImpl method resumeWorkflow.

/**
 * Resume the list of workflows.
 * @param workflowIds - list of workflow Ids  to perform resume operation on
 * @return bulk response object containing a list of succeeded workflows and a list of failed ones with errors
 */
@Service
public BulkResponse resumeWorkflow(List<String> workflowIds) {
    BulkResponse bulkResponse = new BulkResponse();
    for (String workflowId : workflowIds) {
        try {
            workflowExecutor.resumeWorkflow(workflowId);
            bulkResponse.appendSuccessResponse(workflowId);
        } catch (Exception e) {
            LOGGER.error("bulk resumeWorkflow exception, workflowId {}, message: {} ", workflowId, e.getMessage(), e);
            bulkResponse.appendFailedResponse(workflowId, e.getMessage());
        }
    }
    return bulkResponse;
}
Also used : BulkResponse(com.netflix.conductor.service.common.BulkResponse) Service(com.netflix.conductor.annotations.Service)

Example 10 with Service

use of com.netflix.conductor.annotations.Service in project conductor by Netflix.

the class WorkflowBulkServiceImpl method pauseWorkflow.

/**
 * Pause the list of workflows.
 * @param workflowIds - list of workflow Ids  to perform pause operation on
 * @return bulk response object containing a list of succeeded workflows and a list of failed ones with errors
 */
@Service
public BulkResponse pauseWorkflow(List<String> workflowIds) {
    BulkResponse bulkResponse = new BulkResponse();
    for (String workflowId : workflowIds) {
        try {
            workflowExecutor.pauseWorkflow(workflowId);
            bulkResponse.appendSuccessResponse(workflowId);
        } catch (Exception e) {
            LOGGER.error("bulk pauseWorkflow exception, workflowId {}, message: {} ", workflowId, e.getMessage(), e);
            bulkResponse.appendFailedResponse(workflowId, e.getMessage());
        }
    }
    return bulkResponse;
}
Also used : BulkResponse(com.netflix.conductor.service.common.BulkResponse) Service(com.netflix.conductor.annotations.Service)

Aggregations

Service (com.netflix.conductor.annotations.Service)10 BulkResponse (com.netflix.conductor.service.common.BulkResponse)5 Task (com.netflix.conductor.common.metadata.tasks.Task)2 TaskDef (com.netflix.conductor.common.metadata.tasks.TaskDef)2 WorkflowDef (com.netflix.conductor.common.metadata.workflow.WorkflowDef)1 ApplicationException (com.netflix.conductor.core.execution.ApplicationException)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1