Delaying sending of mail until transaction commits

前端 未结 4 515
再見小時候
再見小時候 2021-01-23 06:01

Does anyone have a good tutorial or some advice on how to implement one\'s own XAResource? I need Spring\'s MailSender to be transactional, so that the mail will only be sent on

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-23 06:20

    If you just need to wait for the commit, as you say in a comment, you can investigate using TransactionSynchronizationManager.registerSynchronization() to trigger email sending on commit.

提交回复
热议问题