Announcement Announcement Module
Collapse
No announcement yet.
Retrieving ExecutionContext Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Retrieving ExecutionContext

    Hi, I have question about retrieving ExecutionContext. If some job is successfully finished (of failed does not matter) and after that following code is executed:
    Code:
           JobRepository jobRepository = (JobRepository) applicationContext
    		.getBean("jobRepository");
    
    	boolean jobExists = jobRepository.isJobInstanceExists(job.getName(),
    		jobParameters);
    
    	if (jobExists) {
    	    JobExecution jobExecution = jobRepository.getLastJobExecution(job
    		    .getName(), jobParameters);
    
    	    jobExecution.getExecutionContext() //this is empty
            }
    and ExecutionContext is empty although data is in database.

    Is there any way for me to retrieve data from batch_job_execution_context table?

    Thanks, Ivica.

  • #2
    You are probably using 1.1.x? You can use a JobExecutionListener, or hold on to a reference to the JobExecution in your JobLauncher client.

    In 2.0 you can use JobExplorer to get the JobExecution by ID from the database.

    Comment

    Working...
    X