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

  • 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
Working...
X