How to send emails from a Java EE Batch Job - Stack Overflow
Interesting discussion at SO, posting here for reference in case someone encounter the same problem.
Just to be clear, that discussion is not about how to send out emails from a batch job; it's more about making it transactional:
- how to make sure emails are sent only after all items in a chunk have been successfully written and committed,
- and make sure no emails are sent for any items in a chunk that has failed in any part of read-process-writer cycle for any item in the chunk.