I have a Spring-Batch process that does the following:
- Step:
- Scrape XML into staging table (JibX to Hibernate).
- Validate the initial state of the staged data
- Commit
- Step:
- Transform staging tables into staging (all in SQL).
- Validate the final state of the staged data.
- Commit.
- Step
- Transform staging to warehouse (all in SQL).
- Validate
- Commit
Because my data comes in one big lump, there's no more data coming along and filling up my stage table as I go. This allows me the luxury to change steps and let go of transactions along the way. (Also allowing me to chunk step 1-1)
My general idea for a JMS version was to accept a JMS message and use it to put the data into the staging table, then trigger a Job to do what we do now for validation and then transformation into warehouse. Then use success/failure of the job to drive my response to the item sender.
Unfortunately, Spring Batch does not support (directly) the idea of a job-level transaction, so is there some better accepted way of doing this than stuffing all the tasklets into a transactional ur-tasklet?