简体   繁体   中英

Listener to execute at the end of the input file

I have a process that uses a chunk to read a file and insert the records into a table. I need to be able to insert a row into a parent table at the opening of the input file and when the file is closed I need to update that parent table row inserted at the start. Is there a listener or approach to make this happen?

The closest one is StepListener , where you can implement its beforeStep and afterStep method to update the parent table. You can inject StepContext into the step listener class to access context data through step metrics or step transient data.

But beforeStep is called before opening the input file. Not sure if this diff is significant for your case.

Otherwise, you can implement your own item reader class to achieve your requirement.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM