Announcement Announcement Module
No announcement yet.
How to initialise per job rather than per item? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to initialise per job rather than per item?


    How would one go about executing code on a per job basis rather than per item?

    For example, if you wanted to send an email for each row returned from a DB call. So you process each row as an item, but the email template is the same for each person (which let's just say is retrieved/concocted using some non-trivial processing) so you only want to call that once as opposed to for each item n number of times.

    Is there a common strategy for this kind of scenario using Spring Batch?

    Thanks in advance,

  • #2
    One answer is using a Tasklet and just do all the processing in one place. Any others though?