Item Writers

Table A.2. Available Item Writers
Item WriterDescription
AbstractItemStreamItemWriterAbstract base class that combines the ItemStream and ItemWriter interfaces.
AmqpItemWriterGiven a Spring AmqpTemplate it provides for synchronous send method. The convertAndSend(Object) method lets you send POJO objects.
CompositeItemWriterPasses an item to the process method of each in an injected List of ItemWriter objects
FlatFileItemWriterWrites to a flat file. Includes ItemStream and Skippable functionality. See section on Writing to a File
GemfireItemWriterUsing a GemfireOperations object, items wre either written or removed from the Gemfire instance based on the configuration of the delete flag
HibernateItemWriterThis item writer is hibernate session aware and handles some transaction-related work that a non-"hibernate aware" item writer would not need to know about and then delegates to another item writer to do the actual writing.
IbatisBatchItemWriterWrites items in a batch using the iBatis API's directly. This ItemWriter is deprecated as of Spring Batch 3.0.
ItemWriterAdapterAdapts any class to the ItemWriter interface.
JdbcBatchItemWriterUses batching features from a PreparedStatement, if available, and can take rudimentary steps to locate a failure during a flush.
JmsItemWriterUsing a JmsOperations object, items are written to the default queue via the JmsOperations.convertAndSend() method
JpaItemWriterThis item writer is JPA EntityManager aware and handles some transaction-related work that a non-"jpa aware" ItemWriter would not need to know about and then delegates to another writer to do the actual writing.
MimeMessageItemWriterUsing Spring's JavaMailSender, items of type MimeMessage are sent as mail messages
MongoItemWriterGiven a MongoOperations object, items are written via the MongoOperations.save(Object) method. The actual write is delayed until the last possible moment before the transaction commits.
Neo4jItemWriterGiven a Neo4jOperations object, items are persisted via the save(Object) method or deleted via the delete(Object) per the ItemWriter's configuration
PropertyExtractingDelegatingItemWriterExtends AbstractMethodInvokingDelegator creating arguments on the fly. Arguments are created by retrieving the values from the fields in the item to be processed (via a SpringBeanWrapper) based on an injected array of field name
RepositoryItemWriterGiven a Spring Data CrudRepository implementation, items are saved via the method specified in the configuration.
StaxEventItemWriterUses an ObjectToXmlSerializer implementation to convert each item to XML and then writes it to an XML file using StAX.