Maralc
Maralc

Reputation: 906

Where does Spring Batch saves the batch execution state?

I have a spring batch job that takes a long time to execute. After executing for a while I decided I wanted to stop it but whenever I restart the server the job still continues executing after the server come back up.

I want to know where spring batch saves the state so that I can possibly delete it and stop that from happening.

I found out there are properties that I can configure to not have the job restartable and I will use that going forward but now I just need to make sure the job can stop for good.

Upvotes: 1

Views: 986

Answers (2)

Niraj Sonawane
Niraj Sonawane

Reputation: 11055

if you just want to prevent restart of job below config should help you. preventRestart() helps to avoid restart of job

https://docs.spring.io/spring-batch/trunk/apidocs/org/springframework/batch/core/job/builder/JobBuilderHelper.html

@Bean
        public Job myJob(JobBuilderFactory jobs) throws Exception {
            return jobs.get("myJob")
                    .flow(step1())                          
                    .build()                
                    .preventRestart()
                    .build();

        } 

Upvotes: 1

amdg
amdg

Reputation: 2239

You can see the documentation here which shows & describes the spring Batch Meta-Data tables.

Upvotes: 1

Related Questions