Interface ItemWriter

All Known Implementing Classes:
AbstractItemWriter

public interface ItemWriter
ItemWriter defines the batch artifact that writes to a list of items for chunk processing.
  • Method Summary

    Modifier and Type
    Method
    Description
    The checkpointInfo method returns the current checkpoint data for this writer.
    void
    The close method marks the end of use of the ItemWriter.
    void
    open(Serializable checkpoint)
    The open method prepares the writer to write items.
    void
    The writeItems method writes a list of item for the current chunk.
  • Method Details

    • open

      void open(Serializable checkpoint) throws Exception
      The open method prepares the writer to write items. The input parameter represents the last checkpoint for this writer in a given job instance. The checkpoint data is defined by this writer and is provided by the checkpointInfo method. The checkpoint data provides the writer whatever information it needs to resume writing items upon restart. A checkpoint value of null is passed upon initial start.
      Parameters:
      checkpoint - specifies the last checkpoint
      Throws:
      Exception - is thrown for any errors.
    • close

      void close() throws Exception
      The close method marks the end of use of the ItemWriter. The writer is free to do any cleanup necessary.
      Throws:
      Exception - is thrown for any errors.
    • writeItems

      void writeItems(List<Object> items) throws Exception
      The writeItems method writes a list of item for the current chunk.
      Parameters:
      items - specifies the list of items to write. This may be an empty list (e.g. if all the items have been filtered out by the ItemProcessor).
      Throws:
      Exception - is thrown for any errors.
    • checkpointInfo

      Serializable checkpointInfo() throws Exception
      The checkpointInfo method returns the current checkpoint data for this writer. It is called before a chunk checkpoint is committed.
      Returns:
      checkpoint data
      Throws:
      Exception - is thrown for any errors.