Announcement Announcement Module
No announcement yet.
Custom skip policy Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom skip policy


    When implementing a batch a requirement is to allow a percentage of items to skip before failing the job as a whole. Additionally I should not even consider this test until I pass a certain threshold, i.e. if the first record fails, that's a 100% failure rate .... until the second record is processed & succeeds etc etc...

    I'm assuming that a custom skip policy is the way forward here. However whilst I can see that it'd be a simple task to implement this based on a fixed number of items I cannot see how I can get the number of items processed or saved dynamically.

    Ideally I'd like to know how many items I've processed / saved on entering my custom skip policy so that I can work out my % failure rate.

    Hope that makes sense, any help greatly appreciated.

  • #2
    How about implementing a StepExecutionListener?

    public ExitStatus afterStep(StepExecution stepExecution) {
    if(stepExecution.getReadCount() > 0) {" Step Summary: " + stepExecution.getSummary());
    return stepExecution.getExitStatus();
    } else {
    return ExitStatus.FAILED;

    Step Summary: StepExecution: id=0, version=2, name=fixedLengthStep1, status=COMPLETED, exitStatus=COMPLETED, readCount=5, filterCount=0, writeCount=5 readSkipCount=1, writeSkipCount=0, processSkipCount=0, commitCount=1, rollbackCount=0

    I think the step summary might provide you with the counts you need to work out your failure rate. Once the rate hits a certain point then return an ExitStatus.FAILED;



    • #3
      Not a bad idea!

      I'll try heading off down this route.