java - How to get the failures count after Spring Batch Job? -
i'd specific skip policy on spring batch jobs. job not terminated on few failures. anyhow, when job finished, i'd count how many failures occurred.
stepbuilderfactory.get("step")....skiplimit(10).skip(customexception.class); jobexecution result = joblauncher.run(job, params); result.getallfailureexceptions().size(); //always = 0 problem: failure size = 0 when errors supposed skipped not counted. if remove skiplimit, job terminate immediately.
so how can error count after job run?
you can try following.
int failures = 0; collection<stepexecution> stepexecutions = result.getstepexecutions(); for(stepexecution se : stepexecutions) failures += se.getskipcount(); in result should have number of failures
Comments
Post a Comment