Dec 22nd, 2011, 10:09 AM
Clarification needed with Spring batch concepts
I am new at Spring batch and I am having an issue implementing my business use case with Spring batch.
Basically, I am reading data from a database i.e. a List of subscribers to a newsletter. I then need to send an email to each subscriber as well as to insert data into the database in order to know which subscriber the email was sent to.
I use an ItemProcessor implementation whose process method returns a MimeMessage and takes a subscriber as an argument; the writer associated with this processor is of type: org.springframework.batch.item.mail.javamail.MimeM essageItemWriter.
The issue is that I need another writer for the database inserts (possibly using a CompositeItemWriter) that takes a List of subscribers as an argument and all I have as input is a MimeMessage from the above ItemProcessor.
Can anyone please help?
Dec 26th, 2011, 07:49 AM
You will have to move the processing that you are doing in the processor to the writer, then using the CompositeItemWriter you will be able to send message & write to database for the same user.
Dec 27th, 2011, 08:28 AM
Thanks for the reply.
Originally Posted by rishishehrawat