Ravi
Ravi

Reputation: 1

Spring batch Custom count based on some logic

In processor,

I call third-party System and based on the response I am increasing success or failure count. I want to write both counts to log file. How to know that JOB completed from the processor?

Thanks in advance.

Upvotes: 0

Views: 318

Answers (1)

Mahmoud Ben Hassine
Mahmoud Ben Hassine

Reputation: 31710

How to know that JOB completed from the processor?

Well, if you are in the processor, this means the job is still running. Do you agree?

What you can do is add the metrics in the job execution context (or step execution context) from within the processor and register a JobExecutionListener that reads those metrics from the execution context and write them to a log file after the job is finished (see JobExecutionListener#afterJob).

Hope this helps.

Upvotes: 1

Related Questions