Reputation: 290
I have a scenario that following below steps:
1. The reader will get a list A from table A.
2. The processor processes list A to return object A and MimeMessage.
3. The writer writes object A into table B and use MimeMessage to send mail.
Could I use CompositeItemProcessor and CompositeItemWriter for my scenario above? If yes, how can I set the output object in Step configuration and how to define which ItemWriter for send mail will take MimeMessage and ItemWriter for insert database will take object A.
Are there any better solutions for my problem?
Upvotes: 0
Views: 951
Reputation: 31600
how to define which ItemWriter for send mail will take MimeMessage or ItemWriter for insert database will take object A.
You can use a ClassifierCompositeItemWriter. This composite writer uses a Classifier
to classify items (Type A or MimeMessage in your case) and calls one of the delegate writers for each type.
Upvotes: 1