以批量发送邮件 [英] Email sending in Spring batch

查看:189
本文介绍了以批量发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Spring批次很新。处理一些记录后,我有要求从我的应用程序发送邮件。通过许多链接。但是我没有发现任何有用的东西。有人可以帮助我吗?

解决方案

你需要实现一个 JobExecutionListener 以下列方式将其添加到您的工作中:

 < batch:job id =provisionAddOns> 
< batch:step id =cpsProvisionAddOns>
...
< / batch:step>
< batch:listeners>
< batch:listener>
< bean class =EmailNotification/>
< / batch:listener>
< / batch:listeners>
< / batch:job>

这里 EmailNotification implements JobExecutionListener 并发送电子邮件到 afterJob()方法;您可以使用任何您喜欢的方式根据需要发送电子邮件。


I am very new to Spring batch. I have a requirement to send mail from my application after processing some records. Went through many links. But i did not find anything useful. Can somebody help me?

解决方案

You need to implement a JobExecutionListener and add it to your job in the following manner:

<batch:job id="provisionAddOns" >
    <batch:step id="cpsProvisionAddOns">
       ...
    </batch:step>
    <batch:listeners>
        <batch:listener>
            <bean class="EmailNotification" />
        </batch:listener>
    </batch:listeners>
</batch:job>

Here EmailNotification implements JobExecutionListener and send the email in the afterJob() method; you can use any method you like to send emails depending on your needs.

这篇关于以批量发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆