0

I have a Spring-Batch process that does the following:

  1. Step:
    1. Scrape XML into staging table (JibX to Hibernate).
    2. Validate the initial state of the staged data
    3. Commit
  2. Step:
    1. Transform staging tables into staging (all in SQL).
    2. Validate the final state of the staged data.
    3. Commit.
  3. Step
    1. Transform staging to warehouse (all in SQL).
    2. Validate
    3. 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?

Jon Bristow
  • 1,675
  • 3
  • 27
  • 42
  • for job-level transactionality: http://stackoverflow.com/questions/12492176/job-level-transactionality-in-spring-batch – maxstreifeneder Oct 17 '12 at 17:51
  • Seems more like a hack than anything, since in the SpringBatch world, @Transactional should be applied to a tasklet or lower (Unit of work level). http://stackoverflow.com/questions/8817691/reg-transaction-support-for-a-spring-batch-job-at-job-level provides another approach, but the amount of manipulation required seems to indicate that I am approaching the layout of this design wrong. – Jon Bristow Oct 17 '12 at 17:54
  • honestly seems like a nice hack though. your jsm approach looks okay as well - so why don't do it like that? – maxstreifeneder Oct 17 '12 at 18:13
  • I just assumed that there would be prior art somewhere where someone had done the same thing as me. My problem doesn't seem so unique as to not be supported by just arranging standard libraries properly. – Jon Bristow Oct 17 '12 at 18:24

0 Answers0