Interface TaskOutput


public interface TaskOutput
Methods to get and set output parameters for a job task.
  • Method Summary

    Modifier and Type
    Method
    Description
    Retrieves the task state for a specific state.
    <T> T
    getValue(String name, JobValueType<T> valueType)
    Retrieves the value identified by the given name from the task output.
    <T extends JobValue>
    T
    getValue(String name, Class<T> returnType)
    Retrieves the value identified by the given name from the task output.
    void
    Flags this task for retry.
    void
    setState(TaskState taskState)
    Sets task state for a specific task.
    void
    setValue(String name, Object value)
    Sets the value of a task parameter.
  • Method Details

    • setValue

      void setValue(String name, Object value)
      Sets the value of a task parameter. This can be used by Job.process(JobProcessContext) to set the output parameters of a task when the task is completed.
      Parameters:
      name - name of the parameter
      value - new value to set on the parameter. Must be one of the data types specified in JobValueType or implements JobValue.
    • getValue

      <T> T getValue(String name, JobValueType<T> valueType)
      Retrieves the value identified by the given name from the task output.
      Type Parameters:
      T - type of object requested. Cannot be null.
      Parameters:
      name - name of the object to get from the task output. Cannot be null.
      valueType - type of object requested. Cannot be null.
      Returns:
      the object identified by the given name, or null if there was no value for the given name
    • getValue

      <T extends JobValue> T getValue(String name, Class<T> returnType)
      Retrieves the value identified by the given name from the task output.
      Type Parameters:
      T - type of object requested. Cannot be null.
      Parameters:
      name - name of the object to get from the task output. Cannot be null.
      returnType - type of object requested. Cannot be null.
      Returns:
      the object identified by the given name, or null if there was no value for the given name
    • getState

      TaskState getState()
      Retrieves the task state for a specific state.
      Returns:
      task state
    • setState

      void setState(TaskState taskState)
      Sets task state for a specific task. For example, when a task completes successfully, mark the task as SUCCESS.
      Parameters:
      taskState - task state to set, must be valid value from TaskState
    • setRetry

      void setRetry()
      Flags this task for retry. JobInfo.idempotent() must be set to true. The maximum number of retries per task is 10.