How would one implement a custom counter in itemProcessor? A basic counter could work as defined here, but I need the counter not to include retried items or items in rolled back chuncks. Maybe there is itemStream like interface for itemProcessor that I haven't found yet. Using SpringBatch 2.1.7.
EDIT:
The batch configuration can be found here (Using compositeProcessor). I've tried to implement the counter like follows (with no luck):
Setting itemProcessListener for all processors and in afterProcess(I,O) increment the counters for each processor in a cache (cache also is in each processor). Then using itemWriteListener for all processors and in afterWrite() flush the cache to stepExecution. But this don't work as the itemProcessListener is not working with the compositeProcessors child processors as I would have expected. Any other idea?
EDIT:
I've removed the compositeProcessor and tried to use only a single processor and found out that the itemProcessListener.afterProcess will be called too many times. I am guessing that this is related to the chunk-processing-mode vs. single-processing-mode. So some of the not retried items of a chunk will be re-processed. I've also tried to use RetryListener (to disable counter increments if a retry is in progress), but was not able to configure it. The open and close would not have been called on RetryListener.