Announcement Announcement Module
No announcement yet.
StepExecution executionContext from ItemWriter not visible from JobExecution Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • StepExecution executionContext from ItemWriter not visible from JobExecution

    Hi ,

    I am a Spring-batch newbie.

    I have job which has 2 steps:
    [1] listing of files in a directory
    [2] writing these files into a separate location, and a database insert/indexing

    Step2 takes a fair amount of time.I am using a CustomWriter that implements ItemWriter for step2. Apart from the item readCount which happens implicitly during the ItemWriter write() , I calculate the size of the file and wish that to be available at a later point of time. So I decided to implement the ItemStream interface in my CustomWriter class to store the custom value in the ExecutionContext of the step.

    Now the place where I launch the Job, i have a JobExplorer reference to retrieve the JobExecution. I launch the Job, wait for a while, and then retrieve the jobExecution and the StepExecutions within it. I was surprised to find that the custom values I had populated in the ItemWriter do not show up when introspecting the JobExecution's StepExecutions.

    Instead of implementing the ItemStream interface, I tried the StepExecutionlistener interface too, but the effect was the same. i could see the value inserted in the StepExecution's executionContext in the CustomWriter, but it did not show up when I browsed the jobExecution in another class.

    I am at a loss how to solve this.
    Any help or pointers will be much appreciated.

    thanks in advance,