How to send multiple emails using spring batch

只愿长相守 提交于 2019-12-11 20:44:42

问题


I need to send multiple emails to many users in my application using Spring Batch. I am new to Spring Batch. Need some pointers for it.


回答1:


This Question is way to vague, so my answer will also have to be very vague.

Spring Batch is based on Spring, so you can just use Spring's Email Support, read the corresponding section from the reference manual

In Spring Batch, there are different places where you can register listeners, e.g.

  • Jobs
  • Steps
  • Chunks

Each of these listeners can be a custom implementation that sends emails using the Techniques described in the link above, using MailSender and SimpleMailMessage.

You could of course also implement an Email-based ItemWriter, but I'd hardly call that a good practice.




回答2:


Moreover, you could write a Mail Service used by your application.

Then, use this service as a Processor in your batch : Reusing Existing Services



来源:https://stackoverflow.com/questions/5089283/how-to-send-multiple-emails-using-spring-batch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!