-
Jun 2nd, 2010, 06:42 AM
#1
Problem with JobExecutionListener
Hi all,
I'm having a problem when finish a job. It suposes that the listener i've implemented should execute when the job is finished, but it don't do it. I have the following conf:
<batch:job id="leerBBDDJob">
<batch:step id="imprimirPorConsola">
<batch:tasklet>
<batch:chunk reader="gestionesItemReader"
processor="tratarFila"
writer="gestionesItemWriter"
commit-interval="1" />
<batch:listeners>
<batch:listener ref="gestionesListener"/>
<batch:listener ref="finishJob"/>
</batch:listeners>
</batch:tasklet>
</batch:step>
</batch:job>
<bean id="finishJob" class="com.FinishJobItemListener" />
And the Java class that implements JobExecutionListener:
public class FinishJobItemListener implements JobExecutionListener{
protected final Log _logger = LogFactory.getLog(FinishJobItemListener.class);
public void beforeJob(JobExecution jobExecution){
_logger.info("[" + this.getClass().getName() + "] beforeJob() Antes de ejecutar el job");
}
public void afterJob(JobExecution jobExecution){
_logger.info("[" + this.getClass().getName() + "] afterJob() Despues de ejecutar el job");
if (jobExecution.getStatus() == BatchStatus.COMPLETED ){
//job success
}
else if (jobExecution.getStatus() == BatchStatus.FAILED){
//job failure
}
}
}
Which could be the problem??. Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules