Results 1 to 3 of 3

Thread: Passing Data Between Steps

  1. #1
    Join Date
    Sep 2012
    Location
    Pune
    Posts
    4

    Default Passing Data Between Steps

    Hi,

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

    Process.jpg

    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.

    Regards,
    Chaitanya S. Yardi.

  2. #2
    Join Date
    Mar 2010
    Location
    USA
    Posts
    119

    Default

    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. #3
    Join Date
    Sep 2012
    Location
    Pune
    Posts
    4

    Default

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

    I checked the source of TaskletStep.java 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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •