Search code examples
springspring-batchmonitoringspring-boot-actuatorspring-cloud-dataflow

Spring Cloud Data Flow monitoring prevents task from finishing


I am trying to monitor my Spring Cloud Data Flow batch tasks and the documentation states the following:

To enable Task metrics integration with Data Flow, you must add the spring-boot-starter-actuator to your task application.

This is great, however this makes your application to run indefinitely, since there is a web running. When the batch code finishes, application still continues with the execution and so does the monitoring. So in practice, the batch processing is done but monitoring still thinks that the job is running.

enter image description here

enter image description here

Since the documentation does not say how to handle this issue.

What is the correct way to close the application after the job has completed ?


Solution

  • As mentioned in the comment above, this issue is solved in https://stackoverflow.com/a/60160977/8092044

    Spring Cloud Task provides the

    spring.cloud.task.closecontext_enabled=true
    

    property, which closes the context after task has been executed.

    No additional configuration needed.