Class TaskClient

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

public final class TaskClient extends Object
Client for conductor task management including polling for task, updating task status etc.
  • 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(TaskClientListener listener)
    • pollTask

      public Task pollTask(String taskType, String workerId, String domain)
      Perform a poll for a task of a specific task type.
      Parameters:
      taskType - The taskType to poll for
      domain - The domain of the task type
      workerId - Name of the client worker. Used for logging.
      Returns:
      Task waiting to be executed.
    • batchPollTasksByTaskType

      public List<Task> batchPollTasksByTaskType(String taskType, String workerId, int count, int timeoutInMillisecond)
      Perform a batch poll for tasks by task type. Batch size is configurable by count.
      Parameters:
      taskType - Type of task to poll for
      workerId - Name of the client worker. Used for logging.
      count - Maximum number of tasks to be returned. Actual number of tasks returned can be less than this number.
      timeoutInMillisecond - Long poll wait timeout.
      Returns:
      List of tasks awaiting to be executed.
    • batchPollTasksInDomain

      public List<Task> batchPollTasksInDomain(String taskType, String domain, String workerId, int count, int timeoutInMillisecond)
      Batch poll for tasks in a domain. Batch size is configurable by count.
      Parameters:
      taskType - Type of task to poll for
      domain - The domain of the task type
      workerId - Name of the client worker. Used for logging.
      count - Maximum number of tasks to be returned. Actual number of tasks returned can be less than this number.
      timeoutInMillisecond - Long poll wait timeout.
      Returns:
      List of tasks awaiting to be executed.
    • updateTask

      public void updateTask(TaskResult taskResult)
      Updates the result of a task execution. If the size of the task output payload is bigger than ExternalPayloadStorage, if enabled, else the task is marked as FAILED_WITH_TERMINAL_ERROR.
      Parameters:
      taskResult - the TaskResult of the executed task to be updated.
    • updateTaskV2

      public Task updateTaskV2(TaskResult taskResult)
      Updates the result of a task execution. If the size of the task output payload is bigger than ExternalPayloadStorage, if enabled, else the task is marked as FAILED_WITH_TERMINAL_ERROR.
      Parameters:
      taskResult - the TaskResult of the executed task to be updated.
    • evaluateAndUploadLargePayload

      public Optional<String> evaluateAndUploadLargePayload(Map<String,Object> taskOutputData, String taskType)
    • ack

      public Boolean ack(String taskId, String workerId)
      Ack for the task poll.
      Parameters:
      taskId - Id of the task to be polled
      workerId - user identified worker.
      Returns:
      true if the task was found with the given ID and acknowledged. False otherwise. If the server returns false, the client should NOT attempt to ack again.
    • logMessageForTask

      public void logMessageForTask(String taskId, String logMessage)
      Log execution messages for a task.
      Parameters:
      taskId - id of the task
      logMessage - the message to be logged
    • getTaskLogs

      public List<TaskExecLog> getTaskLogs(String taskId)
      Fetch execution logs for a task.
      Parameters:
      taskId - id of the task.
    • getTaskDetails

      public Task getTaskDetails(String taskId)
      Retrieve information about the task
      Parameters:
      taskId - ID of the task
      Returns:
      Task details
    • removeTaskFromQueue

      public void removeTaskFromQueue(String taskType, String taskId)
      Removes a task from a taskType queue
      Parameters:
      taskType - the taskType to identify the queue
      taskId - the id of the task to be removed
    • getQueueSizeForTask

      public int getQueueSizeForTask(String taskType)
    • getQueueSizeForTask

      public int getQueueSizeForTask(String taskType, String domain, String isolationGroupId, String executionNamespace)
    • getPollData

      public List<PollData> getPollData(String taskType)
      Get last poll data for a given task type
      Parameters:
      taskType - the task type for which poll data is to be fetched
      Returns:
      returns the list of poll data for the task type
    • getAllPollData

      public List<PollData> getAllPollData()
      Get the last poll data for all task types
      Returns:
      returns a list of poll data for all task types
    • requeueAllPendingTasks

      public String requeueAllPendingTasks()
      Requeue pending tasks for all running workflows
      Returns:
      returns the number of tasks that have been requeued
    • requeuePendingTasksByTaskType

      public String requeuePendingTasksByTaskType(String taskType)
      Requeue pending tasks of a specific task type
      Returns:
      returns the number of tasks that have been requeued
    • search

      public SearchResult<TaskSummary> search(String query)
      Search for tasks based on payload
      Parameters:
      query - the search string
      Returns:
      returns the SearchResult containing the TaskSummary matching the query
    • searchV2

      public SearchResult<Task> searchV2(String query)
      Search for tasks based on payload
      Parameters:
      query - the search string
      Returns:
      returns the SearchResult containing the Task matching the query
    • search

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

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

      public void populateTaskPayloads(Task task)