spring-batch
spring-batch copied to clipboard
Public access to AbstractItemCountingItemStreamItemReader.getCurrentItemCount [BATCH-1956]
Jimmy Praet opened BATCH-1956 and commented
Can the getCurrentItemCount() in AbstractItemCountingItemStreamItemReader be made public? Currently the setter is public, but the getter is protected.
Ideally it would be in a new ItemCountAwareItemStreamReader interface, that way the method can also be called on job-scoped instances with the default JDK proxies instead of cglib.
My current use case for this is creating a SkippableItemReader that is capable of skipping records based on a specific configuration table that stores the record numbers to skip per job instance. At the moment I had to create a SkippableFlatFileItemReader and SkippableStaxEventItemReader (with duplicated code). I would prefer creating a SkippableItemReader that can delegate to any AbstractItemCountingItemStreamItemReader / ItemCountAwareItemStreamReader.
No further details from BATCH-1956
Michael Minella commented
For this type of functionality, we typically recommend using an ItemProcessor as a filter. Read in everything, and filter those items that are not to be updated out by returning null from the ItemProcessor.