Saiteja Chilagani
Saiteja Chilagani

Reputation: 1

Spring Batch Running duplicate steps(more than once) in a tasklet

Let's say I have following flow, Start->Step1->Step2->Step3->Step2->End

I have created tasklets for each step and configured a Job as above. When the job got triggered, the execution is fine till Step3 and it goes into a loop infinitely. So is there a way to a step more than once in a JobFlow.

I am using Spring Batch 4.2.1.RELEASE.

Upvotes: 0

Views: 442

Answers (1)

Jonathan Cabral
Jonathan Cabral

Reputation: 65

How are you writting your job? I used to have this kind of problem when I use many flows based on batch desions.

Have you tried something like this?

@Bean
fun jobSincAdUsuario(): Job {
    estatisticas.reset()
    return job.get("batch-job")
            .incrementer(RunIdIncrementer())
            .start(step1())
            .next(step2())
            .next(step3())
            .next(step2())
            .build().build()
}

Upvotes: 0

Related Questions