I am using almost no annotations and all my readers, processors and writers are non-transactional. I only work on flat files and XML files.
It only is a problem in testing because of the test data, I hope it never occured in Production, but I cannot be sure.
I can reproduce this behaviour, with only one read item which is not valid. I get no exception, the OnSkip method is not called and it returns with Status completed.
I cannot say that this will never happen in our production environment....
edit:
After reading your question I went into debugging the code some more and my problem seeems to lie in this piece of code in the
FaultTolerantChunkProcessor:
Code:
public O doWithRetry(RetryContext context) throws Exception {
O output = null;
try {
count.incrementAndGet();
O cached = (cacheIterator != null && cacheIterator.hasNext()) ? cacheIterator.next() : null;
if (cached != null && !processorTransactional) {
output = cached;
}
else {
output = doProcess(item);
if (!processorTransactional && !data.scanning()) {
cache.add(output);
}
}
}
catch (Exception e) {
if (rollbackClassifier.classify(e)) {
// Default is to rollback unless the classifier
// allows us to continue
throw e;
}
else if (shouldSkip(itemProcessSkipPolicy, e, contribution.getStepSkipCount())) {
// If we are not re-throwing then we should check if
// this is skippable
contribution.incrementProcessSkipCount();
logger.debug("Skipping after failed process with no rollback", e);
// If not re-throwing then the listener will not be
// called in next chunk.
callProcessSkipListener(item, e);
}
else {
// If it's not skippable that's an error in
// configuration - it doesn't make sense to not roll
// back if we are also not allowed to skip
throw new NonSkippableProcessException(
"Non-skippable exception in processor. Make sure any exceptions that do not cause a rollback are skippable.",
e);
}
}
It goes into the coding with the rollbackClassifier not to the next where I need it to go. So far I never had to add any policies or check Classifiers....so maybe I may have some configuration wrong , but what I do not know.
I tried to use a NeverRetryPolicy but that changed nothing. I also tried to make the itemProcessors non transactional, which als serves no purpose for my problem.
this Rollback Classifier is set inside the Processor
Code:
private Classifier<Throwable, Boolean> rollbackClassifier = new BinaryExceptionClassifier(true);
How do I get this to call the skip part of the above code?