Hi,
I am a novice in Spring Batch. I have a problem when using TaskExecutorRepeatTemplate. The below sample code snippet is working fine when reading from a file and writing to a console, but it fails when reader is JdbcCursorItemReader and writer is BatchSqlUpdateItemWriter (I am using reader and writer from batchUpdateJob.xml ). The problem is the writer is not flushing the data. Can any one please point out where I am going wrong. Thanks in Advance.
code snippet:
TaskExecutorRepeatTemplate template = new TaskExecutorRepeatTemplate();
template.setTaskExecutor(new SimpleAsyncTaskExecutor());
template.setThrottleLimit(3);
TradeWriter writer = new TradeWriter();
TradeItemReader reader = new TradeItemReader(new ClassPathResource("trades.csv"));
reader.open(new ExecutionContext());
final RepeatCallback callback = new ItemReaderRepeatCallback(reader,writer) {
public ExitStatus doInIteration(RepeatContext context)
throws Exception {
return super.doInIteration(context);
}
};
template.iterate(callback);


Reply With Quote