Tuesday, February 15, 2011

spring+wicket + quartz continues 2...

adding job execution triggers

//job listener implementation
public class Epb5JobExecutionListener extends org.quartz.listeners.JobListenerSupport {

public String getName() {
return "Epb5JobExecutionListener";
}

public void jobWasExecuted(
JobExecutionContext context,
JobExecutionException jobException
) {
//real implementation comes here
}
}

for example, if the job was successfully executed - jobException is null
and context.getJobDetail().getName() and context.getJobDetail().getJobClass() gives info which job was actually executed.

//in spring applicationContext.xml

<!-- scheduler -->
<bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="export2StatisticsTriggerBean" />
<ref bean="ldapUsersUpdateTriggerBean" />
</list>
</property>
<property name="globalJobListeners">
<list>
<bean class="at.kds.epb5.bl.Epb5JobExecutionListener"/>
</list>
</property>
</bean>

to sum up, the overall porting of exports implementation took me 3-5 more time than the initial implementation mostly because of the luck of detailed docs

No comments:

Post a Comment