Back Forum Reply New

Accessing the Step Data to StepExecutionListner

Hi,

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.

lt;batch:job id=quot;jobReplicationquot; gt;
lt;batch:step id=quot;replicationStepquot; gt;
lt;batch:taskletgt;
lt;batch:chunk reader=quot;sourceReaderquot; processor=quot;dataProcessorquot;
writer=quot;compositeWriterquot; commit-interval=quot;5quot; gt;
lt;/batch:chunkgt;
lt;/batch:taskletgt;
lt;/batch:stepgt;

lt;/batch:jobgt;

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.
Thanks

Hi, any one can suggesthere ?

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).
¥
Back Forum Reply New