Package org.springframework.cloud.task.repository

# Interface TaskRepository

All Known Implementing Classes:
  `SimpleTaskRepository`

public interface TaskRepository
TaskRepository interface offers methods that create and update task execution information.

Author:
  Glenn Renfro, Michael Minella

- ## Method Summary

  Modifier and Type
  Method
  Description
  `TaskExecution`
  `completeTaskExecution(long executionId, Integer exitCode, Date endTime, String exitMessage)`
  Notifies the repository that a taskExecution has completed.
  `TaskExecution`
  `completeTaskExecution(long executionId, Integer exitCode, Date endTime, String exitMessage, String errorMessage)`
  Notifies the repository that a taskExecution has completed.
  `TaskExecution`
  `createTaskExecution()`
  Creates an empty TaskExecution with just an id provided.
  `TaskExecution`
  `createTaskExecution(String name)`
  Creates an empty TaskExecution with just an id and name provided.
  `TaskExecution`
  `createTaskExecution(TaskExecution taskExecution)`
  Notifies the repository that a taskExecution needs to be created.
  `TaskExecution`
  `startTaskExecution(long executionid, String taskName, Date startTime, List<String> arguments, String externalExecutionId)`
  Notifies the repository that a taskExecution has has started.
  `TaskExecution`
  `startTaskExecution(long executionid, String taskName, Date startTime, List<String> arguments, String externalExecutionId, Long parentExecutionId)`
  Notifies the repository that a taskExecution has has started.
  `void`
  `updateExternalExecutionId(long executionid, String externalExecutionId)`
  Notifies the repository to update the taskExecution's externalExecutionId.

- ## Method Details

  - ### completeTaskExecution

    @Transactional("springCloudTaskTransactionManager") TaskExecution completeTaskExecution(long executionId, Integer exitCode, Date endTime, String exitMessage)
    Notifies the repository that a taskExecution has completed.
    Parameters:
      `executionId` - to the task execution to be updated.
      `exitCode` - to be stored for this task.
      `endTime` - designated when the task completed.
      `exitMessage` - to be stored for the task.
    Returns:
      the updated `TaskExecution`

  - ### completeTaskExecution

    @Transactional("springCloudTaskTransactionManager") TaskExecution completeTaskExecution(long executionId, Integer exitCode, Date endTime, String exitMessage, String errorMessage)
    Notifies the repository that a taskExecution has completed.
    Parameters:
      `executionId` - to the task execution to be updated.
      `exitCode` - to be stored for this task execution.
      `endTime` - designated when the task completed.
      `exitMessage` - to be stored for the task execution.
      `errorMessage` - to be stored for the task execution.
    Returns:
      the updated `TaskExecution`
    Since:
      1.1.0

  - ### createTaskExecution

    @Transactional("springCloudTaskTransactionManager") TaskExecution createTaskExecution(TaskExecution taskExecution)
    Notifies the repository that a taskExecution needs to be created.
    Parameters:
      `taskExecution` - a TaskExecution instance containing the startTime, arguments and externalExecutionId that will be stored in the repository. Only the values enumerated above will be stored for this TaskExecution.
    Returns:
      the `TaskExecution` that was stored in the repository. The TaskExecution's taskExecutionId will also contain the id that was used to store the TaskExecution.

  - ### createTaskExecution

    @Transactional("springCloudTaskTransactionManager") TaskExecution createTaskExecution(String name)
    Creates an empty TaskExecution with just an id and name provided. This is intended to be utilized in systems where the request of launching a task is separate from the actual start of a task (the underlying system may need to deploy the task prior to launching, etc).
    Parameters:
      `name` - task name to be associated with the task execution.
    Returns:
      the initial `TaskExecution`

  - ### createTaskExecution

    @Transactional("springCloudTaskTransactionManager") TaskExecution createTaskExecution()
    Creates an empty TaskExecution with just an id provided. This is intended to be utilized in systems where the request of launching a task is separate from the actual start of a task (the underlying system may need to deploy the task prior to launching, etc).
    Returns:
      the initial `TaskExecution`

  - ### startTaskExecution

    @Transactional("springCloudTaskTransactionManager") TaskExecution startTaskExecution(long executionid, String taskName, Date startTime, List<String> arguments, String externalExecutionId)
    Notifies the repository that a taskExecution has has started.
    Parameters:
      `executionid` - to the task execution to be updated.
      `taskName` - the name that associated with the task execution.
      `startTime` - the time task began.
      `arguments` - list of key/value pairs that configure the task.
      `externalExecutionId` - id assigned to the task by the platform.
    Returns:
      TaskExecution created based on the parameters.

  - ### updateExternalExecutionId

    @Transactional("springCloudTaskTransactionManager") void updateExternalExecutionId(long executionid, String externalExecutionId)
    Notifies the repository to update the taskExecution's externalExecutionId.
    Parameters:
      `executionid` - to the task execution to be updated.
      `externalExecutionId` - id assigned to the task by the platform.

  - ### startTaskExecution

    @Transactional("springCloudTaskTransactionManager") TaskExecution startTaskExecution(long executionid, String taskName, Date startTime, List<String> arguments, String externalExecutionId, Long parentExecutionId)
    Notifies the repository that a taskExecution has has started.
    Parameters:
      `executionid` - to the task execution to be updated.
      `taskName` - the name that associated with the task execution.
      `startTime` - the time task began.
      `arguments` - list of key/value pairs that configure the task.
      `externalExecutionId` - id assigned to the task by the platform.
      `parentExecutionId` - the parent task execution id.
    Returns:
      A TaskExecution that contains the information available at the beginning of a TaskExecution.