Skip to main content
Version: 2.82.x.x LTS

Configuration of batch jobs

The following chapters describe how batch jobs are configured. For a more detailed description of the facility, refer to the Spring reference documentation and review the chapter on Scheduling/Quartz integration.

Batch context

The batch context is an XML file containing a Spring application context. A typical configuration contains at least:

  • A scheduler factory (Spring SchedulerFactoryBean). Do not forget to add the property applicationContextSchedulerContextKey to the exportScheduler bean (see also the sample in the chapter Example of a batch job configuration file. If the exportScheduler bean in the batch context XML file does not contain the applicationContextSchedulerContextKey property, the batch processing will not work.
  • One or more batch job definitions (Spring JobDetailBeans)
  • One or more triggers referencing the jobs (Spring SimpleTriggerBeans or CronTriggerBeans)

Specify the path to the batch context in the nevisIDM config properties .

Batch job

Batch jobs are registered by defining a JobDetailBean for each job (see the chapter Example of a batch job configuration file. Job configuration parameters are supplied via the job's JobDataMap.

Trigger

Triggers are registered by defining trigger beans, such as the SimpleTriggerFactoryBean or the CronTriggerFactoryBean. The triggers registered with the scheduler factory will be displayed in the nevisIDM GUI and can also be triggered manually. The GUI will show the trigger's description, the description of the associated job, and the next fire time.

Example of a batch job configuration file

The following configuration fragment shows a sample batch context featuring a scheduler, a dataPorter job for the provisioning of an Active Directory, and a trigger that fires every 24 hours.

<?xml version="1.0" encoding="ISO-8859-1"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

<!-- scheduler factory -->
<bean id="exportScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="dailyActiveDirectoryExportTrigger"/>
<ref bean="everyDayAtOneAmActiveDirectoryExportTrigger"/>
</list>
</property>
<property name="applicationContextSchedulerContextKey" value="applicationContext"/>
</bean>

<!-- batch jobs -->
<bean id="activeDirectoryExportJob" class="org.springframework.scheduling.quartz.JobDetailFactoryBean">
<!-- for display in GUI -->
<property name="description" value="Active Directory Export"/>
<property name="jobClass" value="ch.nevis.idm.batch.jobs.DataPorterExportJob"/>
<property name="durability" value="true"/>
<!-- job parametrization -->
<property name="jobDataMap">
<bean class="org.quartz.JobDataMap">
<constructor-arg>
<map>
<entry key="dataporter.config" value="/home/ahs/work/idmportal-export/adexport-dataporter.xml"/>
<entry key="dataporter.simulate" value="false"/>
</map>
</constructor-arg>
</bean>
</property>
</bean>

<!-- triggers -->
<bean id="dailyActiveDirectoryExportTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerFactoryBean">
<!-- for display in GUI -->
<property name="description" value="Daily Active Directory Export"/>
<!-- job implementation -->
<property name="jobDetail" ref="activeDirectoryExportJob"/>
<!-- job scheduling -->
<property name="repeatInterval" value="86400000"/>
<!-- misfire behavior -->
<property name="misfireInstructionName" value="MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT"/>
</bean>

<bean id="everyDayAtOneAmActiveDirectoryExportTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<!-- for display in GUI -->
<property name="description" value="Every day at 1am Active Directory Export"/>
<!-- job implementation -->
<property name="jobDetail" ref="activeDirectoryExportJob" />
<!-- job scheduling -->
<property name="cronExpression" value="0 0 1 * * ?" />
</bean>
</beans>