Class WorkflowClient

java.lang.Object
com.netflix.conductor.client.http.WorkflowClient

public final class WorkflowClient extends Object
  • Constructor Details

  • Method Details

    • setRootURI

      @Deprecated public void setRootURI(String rootUri)
      Deprecated.
      Kept only for backwards compatibility
      Parameters:
      rootUri - basePath for the ApiClient
    • registerListener

      public void registerListener(WorkflowClientListener listener)
    • startWorkflow

      public String startWorkflow(StartWorkflowRequest startWorkflowRequest)
      Starts a workflow. If the size of the workflow input payload is bigger than ExternalPayloadStorage, if enabled, else the workflow is rejected.
      Parameters:
      startWorkflowRequest - the StartWorkflowRequest object to start the workflow
      Returns:
      the id of the workflow instance that can be used for tracking
    • checkAndUploadToExternalStorage

      public void checkAndUploadToExternalStorage(StartWorkflowRequest startWorkflowRequest)
    • getWorkflow

      public Workflow getWorkflow(String workflowId, boolean includeTasks)
      Retrieve a workflow by workflow id
      Parameters:
      workflowId - the id of the workflow
      includeTasks - specify if the tasks in the workflow need to be returned
      Returns:
      the requested workflow
    • getWorkflows

      public List<Workflow> getWorkflows(String name, String correlationId, boolean includeClosed, boolean includeTasks)
      Retrieve all workflows for a given correlation id and name
      Parameters:
      name - the name of the workflow
      correlationId - the correlation id
      includeClosed - specify if all workflows are to be returned or only running workflows
      includeTasks - specify if the tasks in the workflow need to be returned
      Returns:
      list of workflows for the given correlation id and name
    • deleteWorkflow

      public void deleteWorkflow(String workflowId, boolean archiveWorkflow)
      Removes a workflow from the system
      Parameters:
      workflowId - the id of the workflow to be deleted
      archiveWorkflow - flag to indicate if the workflow should be archived before deletion
    • terminateWorkflows

      public BulkResponse terminateWorkflows(List<String> workflowIds, String reason)
      Terminates the execution of all given workflows instances
      Parameters:
      workflowIds - the ids of the workflows to be terminated
      reason - the reason to be logged and displayed
      Returns:
      the BulkResponse contains bulkErrorResults and bulkSuccessfulResults
    • getRunningWorkflow

      public List<String> getRunningWorkflow(String workflowName, Integer version)
      Retrieve all running workflow instances for a given name and version
      Parameters:
      workflowName - the name of the workflow
      version - the version of the wokflow definition. Defaults to 1.
      Returns:
      the list of running workflow instances
    • getWorkflowsByTimePeriod

      public List<String> getWorkflowsByTimePeriod(String workflowName, int version, Long startTime, Long endTime)
      Retrieve all workflow instances for a given workflow name between a specific time period
      Parameters:
      workflowName - the name of the workflow
      version - the version of the workflow definition. Defaults to 1.
      startTime - the start time of the period
      endTime - the end time of the period
      Returns:
      returns a list of workflows created during the specified during the time period
    • runDecider

      public void runDecider(String workflowId)
      Starts the decision task for the given workflow instance
      Parameters:
      workflowId - the id of the workflow instance
    • pauseWorkflow

      public void pauseWorkflow(String workflowId)
      Pause a workflow by workflow id
      Parameters:
      workflowId - the workflow id of the workflow to be paused
    • resumeWorkflow

      public void resumeWorkflow(String workflowId)
      Resume a paused workflow by workflow id
      Parameters:
      workflowId - the workflow id of the paused workflow
    • skipTaskFromWorkflow

      public void skipTaskFromWorkflow(String workflowId, String taskReferenceName)
      Skips a given task from a current RUNNING workflow
      Parameters:
      workflowId - the id of the workflow instance
      taskReferenceName - the reference name of the task to be skipped
    • rerunWorkflow

      public String rerunWorkflow(String workflowId, RerunWorkflowRequest rerunWorkflowRequest)
      Reruns the workflow from a specific task
      Parameters:
      workflowId - the id of the workflow
      rerunWorkflowRequest - the request containing the task to rerun from
      Returns:
      the id of the workflow
    • restart

      public void restart(String workflowId, boolean useLatestDefinitions)
      Restart a completed workflow
      Parameters:
      workflowId - the workflow id of the workflow to be restarted
      useLatestDefinitions - if true, use the latest workflow and task definitions when restarting the workflow if false, use the workflow and task definitions embedded in the workflow execution when restarting the workflow
    • retryLastFailedTask

      public void retryLastFailedTask(String workflowId)
      Retries the last failed task in a workflow
      Parameters:
      workflowId - the workflow id of the workflow with the failed task
    • resetCallbacksForInProgressTasks

      public void resetCallbacksForInProgressTasks(String workflowId)
      Resets the callback times of all IN PROGRESS tasks to 0 for the given workflow
      Parameters:
      workflowId - the id of the workflow
    • terminateWorkflow

      public void terminateWorkflow(String workflowId, String reason)
      Terminates the execution of the given workflow instance
      Parameters:
      workflowId - the id of the workflow to be terminated
      reason - the reason to be logged and displayed
    • search

      public SearchResult<WorkflowSummary> search(String query)
      Search for workflows based on payload
      Parameters:
      query - the search query
      Returns:
      the SearchResult containing the WorkflowSummary that match the query
    • searchV2

      public SearchResult<Workflow> searchV2(String query)
      Search for workflows based on payload
      Parameters:
      query - the search query
      Returns:
      the SearchResult containing the Workflow that match the query
    • search

      public SearchResult<WorkflowSummary> search(Integer start, Integer size, String sort, String freeText, String query)
      Paginated search for workflows based on payload
      Parameters:
      start - start value of page
      size - number of workflows to be returned
      sort - sort order
      freeText - additional free text query
      query - the search query
      Returns:
      the SearchResult containing the WorkflowSummary that match the query
    • searchV2

      public SearchResult<Workflow> searchV2(Integer start, Integer size, String sort, String freeText, String query)
      Paginated search for workflows based on payload
      Parameters:
      start - start value of page
      size - number of workflows to be returned
      sort - sort order
      freeText - additional free text query
      query - the search query
      Returns:
      the SearchResult containing the Workflow that match the query
    • testWorkflow

      public Workflow testWorkflow(WorkflowTestRequest testRequest)
    • populateWorkflowOutput

      public void populateWorkflowOutput(Workflow workflow)
      Populates the workflow output from external payload storage if the external storage path is specified.
      Parameters:
      workflow - the workflow for which the output is to be populated.