Class SimpleTaskRepository
java.lang.Object
org.springframework.cloud.task.repository.support.SimpleTaskRepository
- All Implemented Interfaces:
TaskRepository
Records the task execution information to the log and to TaskExecutionDao provided.
- Author:
- Glenn Renfro
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Default max error message size.static final int
Default max exit message size.static final int
Default max task name size. -
Constructor Summary
ConstructorDescriptionSimpleTaskRepository
(org.springframework.beans.factory.FactoryBean<TaskExecutionDao> taskExecutionDaoFactoryBean) SimpleTaskRepository
(org.springframework.beans.factory.FactoryBean<TaskExecutionDao> taskExecutionDaoFactoryBean, Integer maxExitMessageSize, Integer maxTaskNameSize, Integer maxErrorMessageSize) -
Method Summary
Modifier and TypeMethodDescriptioncompleteTaskExecution
(long executionId, Integer exitCode, LocalDateTime endTime, String exitMessage) Notifies the repository that a taskExecution has completed.completeTaskExecution
(long executionId, Integer exitCode, LocalDateTime endTime, String exitMessage, String errorMessage) Notifies the repository that a taskExecution has completed.Creates an empty TaskExecution with just an id provided.createTaskExecution
(String name) Creates an empty TaskExecution with just an id and name provided.createTaskExecution
(TaskExecution taskExecution) Notifies the repository that a taskExecution needs to be created.Retrieves the taskExecutionDao associated with this repository.void
setMaxErrorMessageSize
(int maxErrorMessageSize) void
setMaxExitMessageSize
(int maxExitMessageSize) void
setMaxTaskNameSize
(int maxTaskNameSize) startTaskExecution
(long executionid, String taskName, LocalDateTime startTime, List<String> arguments, String externalExecutionId) Notifies the repository that a taskExecution has has started.startTaskExecution
(long executionid, String taskName, LocalDateTime 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.
-
Field Details
-
MAX_EXIT_MESSAGE_SIZE
public static final int MAX_EXIT_MESSAGE_SIZEDefault max exit message size.- See Also:
-
MAX_TASK_NAME_SIZE
public static final int MAX_TASK_NAME_SIZEDefault max task name size.- See Also:
-
MAX_ERROR_MESSAGE_SIZE
public static final int MAX_ERROR_MESSAGE_SIZEDefault max error message size.- See Also:
-
-
Constructor Details
-
SimpleTaskRepository
public SimpleTaskRepository(org.springframework.beans.factory.FactoryBean<TaskExecutionDao> taskExecutionDaoFactoryBean) -
SimpleTaskRepository
public SimpleTaskRepository(org.springframework.beans.factory.FactoryBean<TaskExecutionDao> taskExecutionDaoFactoryBean, Integer maxExitMessageSize, Integer maxTaskNameSize, Integer maxErrorMessageSize)
-
-
Method Details
-
completeTaskExecution
public TaskExecution completeTaskExecution(long executionId, Integer exitCode, LocalDateTime endTime, String exitMessage) Description copied from interface:TaskRepository
Notifies the repository that a taskExecution has completed.- Specified by:
completeTaskExecution
in interfaceTaskRepository
- 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
public TaskExecution completeTaskExecution(long executionId, Integer exitCode, LocalDateTime endTime, String exitMessage, String errorMessage) Description copied from interface:TaskRepository
Notifies the repository that a taskExecution has completed.- Specified by:
completeTaskExecution
in interfaceTaskRepository
- 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
-
createTaskExecution
Description copied from interface:TaskRepository
Notifies the repository that a taskExecution needs to be created.- Specified by:
createTaskExecution
in interfaceTaskRepository
- 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
Description copied from interface:TaskRepository
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).- Specified by:
createTaskExecution
in interfaceTaskRepository
- Parameters:
name
- task name to be associated with the task execution.- Returns:
- the initial
TaskExecution
-
createTaskExecution
Description copied from interface:TaskRepository
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).- Specified by:
createTaskExecution
in interfaceTaskRepository
- Returns:
- the initial
TaskExecution
-
startTaskExecution
public TaskExecution startTaskExecution(long executionid, String taskName, LocalDateTime startTime, List<String> arguments, String externalExecutionId) Description copied from interface:TaskRepository
Notifies the repository that a taskExecution has has started.- Specified by:
startTaskExecution
in interfaceTaskRepository
- 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
Description copied from interface:TaskRepository
Notifies the repository to update the taskExecution's externalExecutionId.- Specified by:
updateExternalExecutionId
in interfaceTaskRepository
- Parameters:
executionid
- to the task execution to be updated.externalExecutionId
- id assigned to the task by the platform.
-
startTaskExecution
public TaskExecution startTaskExecution(long executionid, String taskName, LocalDateTime startTime, List<String> arguments, String externalExecutionId, Long parentExecutionId) Description copied from interface:TaskRepository
Notifies the repository that a taskExecution has has started.- Specified by:
startTaskExecution
in interfaceTaskRepository
- 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.
-
getTaskExecutionDao
Retrieves the taskExecutionDao associated with this repository.- Returns:
- the taskExecutionDao
-
setMaxExitMessageSize
public void setMaxExitMessageSize(int maxExitMessageSize) -
setMaxTaskNameSize
public void setMaxTaskNameSize(int maxTaskNameSize) -
setMaxErrorMessageSize
public void setMaxErrorMessageSize(int maxErrorMessageSize)
-