Announcement Announcement Module
Collapse
No announcement yet.
JobId in itemwriter in multithreaded app Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JobId in itemwriter in multithreaded app

    I need to get JobId in the itemwriter, it is multithreaded web app

    public void beforeStep(StepExecution stepExecution) {

    this.stepExecution = stepExecution;
    }

    public void write(List<? extends T> items) throws Exception {
    ExecutionContext stepContext = stepExecution.getExecutionContext();
    long jobId = stepExecution.getJobExecution().getJobId();
    }
    Using this code returns wrong job id, since beforestep method is called for each job run and so it only returns the latest run jobID.

    Is there a any other way to get jobId in item writer.
    Last edited by shriny; Mar 7th, 2010, 03:24 PM.

  • #2
    uh? Are you familiar with Job, JobInstance and JobExecution? Maybe reading the following will help:
    http://static.springsource.org/sprin...html#domainJob

    What is a JobId for you exactly?

    Comment


    • #3
      Job instance id

      I want to use the job instance id and I solved the issue by making all the beans scope="step"

      Thanks
      Shriny

      Comment

      Working...
      X