Jan 31st, 2011, 12:15 PM
Accessing the Step Data to StepExecutionListner
I have batch application , which reads the data from one data source and replicates the data in target end. upon successful replication I need to update the flag in source table . I am using the spring batch . while replicating the data , if the data is found invalid I need to log into the differnt file at the end of successful step completion.
<batch:job id="jobReplication" >
<batch:step id="replicationStep" >
<batch:chunk reader="sourceReader" processor="dataProcessor"
writer="compositeWriter" commit-interval="5" >
Here I am processing the 5 records each time as a chunk and commiting the 5 records. After reading before sending to the writter I am processing the data with the help of processor. At the successful or failure invocation of step chunk data , i want to take that data and write to the file. How can I do that ? from the docs I understood that it can be done with StepExceution Lister.
Here I am doing the replication within a single step with chunks. lets say if I have 100 records in data base , everytime i am getting the 5 records and processing those 5 records and continuing. if there is any error , i am existing the btach. Upon the succefful replication of chunk data i want to take that processed chunk data and write it.
Feb 1st, 2011, 03:44 AM
Hi, any one can suggesthere ?
Feb 4th, 2011, 09:36 AM
Your config already suggests that the writer is a composite. That's how I would tackle it. Or use an ItemWriteListener if the feature is cross cutting (needed in more than one step).