History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: BATCH-592
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Robert Kasanicky
Reporter: Robert Kasanicky
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Spring Batch

RFC: buffer read items in ItemHandler instead of ItemReader

Created: 18/Apr/08 04:35 AM   Updated: 29/Aug/08 10:18 AM
Component/s: Infrastructure, Core
Affects Version/s: 1.0.0
Fix Version/s: 2.0.0.M2

Time Tracking:
Original Estimate: 2d
Original Estimate - 2d
Remaining Estimate: 0d
Time Spent - 0.5d
Time Spent: 0.5d
Time Spent - 0.5d Time Not Required


 Description  « Hide
I think there is no need to physically re-read items after rollback for none of the readers we provide (except for JmsItemReader I suppose). Therefore the items could be buffered in ItemHandler which would simplify the readers by making them forward-only.

The JMS input use case could be addressed by separate ItemHandler (there are certainly other options as well).


 All   Comments   Work Log   Change History   FishEye   Related Builds      Sort Order: Ascending order - Click to sort in descending order
Dave Syer - 20/Apr/08 03:16 PM
I am in favour of simplifying item reader implementations wherever possible. Putting the buffering responsibilities in an ItemHandler would be one way to do it, or even a third party (like a delegate item reader).

Robert Kasanicky - 29/Apr/08 07:57 AM
Generic buffered item reader that wraps a delegate forward-only item reader seems straightforward to implement. ItemHandler could then do the wrapping so that users needn't declare the wrapper in xml (boilerplate).

I think we can give it a try for 1.1?

Dave Syer - 02/May/08 03:06 AM
The ItemHandler should be able to tell the difference between a reader that needs (or wants) to be buffered and one that doesn't. The JMS reader is the obvious case in point, but there may be generalisations.

Does this also mean that mark() and reset() are no longer part of the ItemReader interface (would be nice)? Maybe an ItemReader just needs a boolean query method say whether it is transaction aware (the JMS case), or whether it needs the handler to buffer items.

Robert Kasanicky - 05/May/08 03:57 AM
Yes, mark() and reset() should be unnecessary on ItemReader. Overall the changes seem quite significant, so scheduling for 2.0.

Dave Syer - 29/Aug/08 10:17 AM
Already done as part of BATCH-789