Announcement Announcement Module
Collapse
No announcement yet.
Problem with storing the values to Job/StepExecutionContext Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with storing the values to Job/StepExecutionContext

    Hi Spring Batch Team,

    I have an issue storing the values to Spring Batch Job/StepExecutionContext.

    My job contains 2 steps:

    1) Step1: Reading dates from text input file and storing the dates in JobExecuctionContext.
    2) Step2: Reading input from text file processing business logic using dates stored in JobExecutionContext and writing the output file.

    My problem is whenever Step2 is restarted, I am loosing the dates stored in JobExecuctionContext while processing Step1.
    I am storing 10 dates as key value pairs into JobExecutionContext while processing Step1.
    When I start Step2, 10 dates are available for Step2 and my processor is working fine.
    The problem is whenever I restart step2, JobExecutionContext is holding only first 2 key value pairs. Remaining 8 key value pairs are removed from JobExecuctionContext.
    Whenever, I looked at JOB_EXECUTION_CONTEXT table, map has entry for each 2 key value pairs. The first entry is returned back whenever Step2 is restarted.

    Is there any solution for this problem? How can I get all the values back from JobExecutionContext when the step is restarted?

    By the way, I tried the same with StepExecutionContext, it is acting the same. Tried ExecutionContextPromotionListener too, acting the same in all scenarios.
    I think it is a problem with how the key value pairs are stored into ExecutionContext.

    Any help will be appreciated.

    Thanks,
    Lavanya

  • #2
    Instead of restarting just step 2, you could start step 1 & 2.

    Comment


    • #3
      Thank you for your reply Rishi.
      Step2 is writing 500 records at a time to output file. The whole purpose of restarting Step2 is to process the remaining records where Step2 is failed. Is there anyway we can restart from Step1 and still start the process where the job is failed?

      Comment

      Working...
      X