Refactored task end event to be Spring Boot's ApplicationReadyEvent
In testing and other use cases, the ability to keep a context open beyond the end of a task can be useful. This change provides the ability to keep the context alive once a task has completed while also explicitly shutting the context down (by default) once a task has ended. Resolves spring-cloud/spring-cloud-task#102
This commit is contained in:
@@ -37,7 +37,6 @@ start event. This event is triggered via `SmartLifecycle#start` being triggered
|
||||
Spring Framework. This indicates to the system that all beans are ready for use and is
|
||||
before the execution of any of the `*Runner`s provided by Spring Boot.
|
||||
|
||||
|
||||
NOTE: The recording of a task will only occur upon the successful bootstrapping of an
|
||||
`ApplicationContext`. If the context fails to bootstrap at all, the task's execution will
|
||||
not be recorded.
|
||||
@@ -46,6 +45,10 @@ Upon completion of all of the `*Runner#run` calls from Spring Boot or the failur
|
||||
`ApplicationContext` (indicated via a `ApplicationFailedEvent`), the task execution is
|
||||
updated in the repository with the results.
|
||||
|
||||
NOTE: At the completion of a task (all `*Runner#run` methods are called and the task
|
||||
repository has been updated) the `ApplicationContext` will be closed. This behavior can
|
||||
be overriden by setting the property `spring.cloud.task.closecontext.enabled` to false.
|
||||
|
||||
[[features-task-execution-details]]
|
||||
=== The TaskExecution
|
||||
|
||||
@@ -70,7 +73,7 @@ assumed to be 0.
|
||||
|The time the task was started as indicated by the `SmartLifecycle#start` call.
|
||||
|
||||
|`endTime`
|
||||
|The time the task was completed as indicated by the `ContextClosedEvent`.
|
||||
|The time the task was completed as indicated by the `ApplicationReadyEvent`.
|
||||
|
||||
|`exitMessage`
|
||||
|Any information available at the time of exit. If an exception is the cause of the end
|
||||
|
||||
Reference in New Issue
Block a user