public interface ItemWriteListener<S> extends StepListener
Listener interface for the writing of items. Implementations of this interface will be notified before, after, and in case of any exception thrown while writing a list of items.
Note: This listener is designed to work around the lifecycle of an item. This means that each method should be called once within the lifecycle of an item and in fault tolerant scenarios, any transactional work that is done in one of these methods would be rolled back and not re-applied. Because of this, it is recommended to not perform any logic using this listener that participates in a transaction.
Modifier and Type | Method and Description |
---|---|
void |
afterWrite(java.util.List<? extends S> items)
Called after
ItemWriter.write(java.util.List) This will be
called before any transaction is committed, and before
ChunkListener.afterChunk(ChunkContext) |
void |
beforeWrite(java.util.List<? extends S> items)
Called before
ItemWriter.write(java.util.List) |
void |
onWriteError(java.lang.Exception exception,
java.util.List<? extends S> items)
Called if an error occurs while trying to write.
|
void beforeWrite(java.util.List<? extends S> items)
ItemWriter.write(java.util.List)
items
- to be writtenvoid afterWrite(java.util.List<? extends S> items)
ItemWriter.write(java.util.List)
This will be
called before any transaction is committed, and before
ChunkListener.afterChunk(ChunkContext)
items
- written itemsvoid onWriteError(java.lang.Exception exception, java.util.List<? extends S> items)
exception
- thrown from ItemWriter
items
- attempted to be written.