Announcement Announcement Module
No announcement yet.
Passing Data Between Steps Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Passing Data Between Steps


    I am trying to write an interface using spring integration and batch as below


    If there are n no records in file then n no records should be inserted into MySQl and Oracle database.

    Further 10 JMS MQ messages should be generated.

    I did the process till MySql DB insert. I can write a task let (chunk) which has itemRead and itemWriter.

    But further how to write the data in Oracle DB and JMS? How to pass the data between steps in batch.

    And very important is everything should be transacted using distributed transaction (XA). Somewhere I read that Spring batch commit after every step. How to propagate the transaction in this case?

    Please suggest the solution.

    Chaitanya S. Yardi.
    Attached Files

  • #2
    Can't you make use of JobExecutionContext to pass data between steps? Tx startes at reader and goes through processor and ends at the writer. so try to have all the queries that you need to do in a single tx within this (reader -processor-writer)- and if you have your transactional attributes as PROPAGATION_REQUIRED, you would get what you need


    • #3
      I have already tried transaction-attributes propagation="REQUIRED" but it did not worked.

      I checked the source of and there is transaction commit/rollback. Therefore transactions is getting completed.

      In addition to this, definitely we can pass the data using JobExecutionContext, But How to tell next Steps' writer to refer JdbExecutionContext .

      Further can we have such Tasklet Step which will not have reader but only writer.

      Please help.