-
Oct 28th, 2011, 01:31 PM
#1
chunk-completion-policy
I have a batch job with commit-interval 100 that calls an external webservice in the ItemProcessor. Sometimes, when this external webservice is under heavy load, the response times are such that we cannot process the chunk within the transaction timeout limit on our WebSphere server (120 seconds).
To avoid this issue, what I'd like to do is commit after 100 records, or after 60 seconds, whichever comes first. So I'm looking into spring batch's support for this and I see it's possible to configure a chunk-completion-policy.
I'm experimenting with the spring batch provided TimeoutTerminationPolicy as chunk-completion-policy, but I notice that the completion policy is checked after reading each item, and not after processing each item?
Does spring batch provide any support for this out of the box?
-
Oct 31st, 2011, 06:50 AM
#2
Only solution I can currently think of is creating a ProcessingItemReader<I, O> that implements ItemReader<O> and has an ItemReader<I> and ItemProcessor<I, O> configured as delegate. In the read method it will read an item from the reader delegate, pass it to the processor delegate and return the processed item. This way the chunk-completion-policy will be called after reading and processing each item.
Does anyone see any problems with this approach?
Thanks
Last edited by jpraet; Oct 31st, 2011 at 07:36 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules