La liste d'utilisateurs n'est pas rendue car vous ne possédez pas les droits d'accès nécessaires pour afficher les profils utilisateur.

Arborescence des pages

  • Aucune étiquette

Commentaire

  1. When we use batch calls with the helpdesk-cron.sh script, for each batch command the esup-helpdesk application is loaded in batch mode so that the Indexer (for example) can update the lucene index.

    For the Indexer, the indexation of some new tickets can be quick (indeed, if there is no new ticket, the execution time is about 1 second) but the call of the batch command itself with helpdesk-cron.sh script can be about 10 seconds because of the loading of all the spring beans (and during this 10 seconds, the CPU is near to 100% of use).

    * So the best is in fact to call this script on a dedicated server for this kind of jobs.

    * But if we have only one server for esup-helpdesk, the best can be to call this cron tasks directly from the esup-helpdesk already loaded on tomcat server.

    Indeed we can make this easily with Spring + Quartz !http://static.springsource.org/spring/docs/current/spring-framework-reference/html/scheduling.html#scheduling-quartz
    To use Quartz instead of Cron, you can modify Batch.java so that required batch methods are public :
    * public static void updateIndex(final boolean rebuild)
    * public static void archiveTickets() {
    * public static void expireTickets(final boolean alerts) {
    * public static void recallTickets() {
    * public static void sendTicketReports() {
    * public static void sendFaqReports() {

    Next we can add quartz jobs with spring : http://static.springsource.org/spring/docs/current/spring-framework-reference/html/scheduling.html#scheduling-quartz
    Below the content of a cron.xml file defining spring beans so that esup-helpdesk tasks work : you can import cron.xml in properties/applicationContext.xml.

    Don't forget to add quartz.jar (for example quartz-1.8.0.jar) in webapp/WEB-INF/lib/ and redeploy.http://www.quartz-scheduler.org/

    <?xml version="1.0" encoding="UTF-8" ?>
    
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
    
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd">
    
    
    <bean id="indexJobDetailQuartz"
    class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
    <property name="targetClass" value="org.esupportail.helpdesk.batch.Batch"/>
    <property name="targetMethod" value="updateIndex" />
    <property name="arguments">
    <list>
    <value>false</value>
    </list>
    </property>
    <property name="concurrent" value="false" />
    </bean>
    
    <bean id="expireTicketsJobDetailQuartz"
    class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
    <property name="targetClass" value="org.esupportail.helpdesk.batch.Batch"/>
    <property name="targetMethod" value="expireTickets" />
    <property name="arguments">
    <list>
    <value>true</value>
    </list>
    </property>
    <property name="concurrent" value="false" />
    </bean>
    
    <bean id="archiveTicketsJobDetailQuartz"
    class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
    <property name="targetClass" value="org.esupportail.helpdesk.batch.Batch"/>
    <property name="targetMethod" value="archiveTickets" />
    <property name="concurrent" value="false" />
    </bean>
    
    <bean id="sendTicketReportsJobDetailQuartz"
    class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
    <property name="targetClass" value="org.esupportail.helpdesk.batch.Batch"/>
    <property name="targetMethod" value="sendTicketReports" />
    <property name="concurrent" value="false" />
    </bean>
    
    <bean id="sendFaqReportsJobDetailQuartz"
    class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
    <property name="targetClass" value="org.esupportail.helpdesk.batch.Batch"/>
    <property name="targetMethod" value="sendFaqReports" />
    <property name="concurrent" value="false" />
    </bean>
    
    <bean id="recallTicketsJobDetailQuartz"
    class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
    <property name="targetClass" value="org.esupportail.helpdesk.batch.Batch"/>
    <property name="targetMethod" value="recallTickets" />
    <property name="concurrent" value="false" />
    </bean>
    
    
    <bean id="indexTriggerQuartz" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
    <property name="jobDetail" ref="indexJobDetailQuartz" />
    <\!-\- start after 600 seconds -->
    <property name="startDelay" value="600000" />
    <\!-\- repeat every 600 seconds -->
    <property name="repeatInterval" value="600000" />
    </bean>
    
    <bean id="expireTicketsCronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
    <property name="jobDetail" ref="expireTicketsJobDetailQuartz"/>
    <\!-\- run every hour at 1 Min-\->
    <property name="cronExpression" value="00 01 * * * ?"/>
    </bean>
    
    <bean id="archiveTicketsCronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
    <property name="jobDetail" ref="archiveTicketsJobDetailQuartz"/>
    <property name="cronExpression" value="00 03 * * * ?"/>
    </bean>
    
    <bean id="sendTicketReportsCronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
    <property name="jobDetail" ref="sendTicketReportsJobDetailQuartz"/>
    <property name="cronExpression" value="00 05 * * * ?"/>
    </bean>
    
    <bean id="sendFaqReportsCronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
    <property name="jobDetail" ref="sendFaqReportsJobDetailQuartz"/>
    <property name="cronExpression" value="00 00 0 * * ?"/>
    </bean>
    
    <bean id="recallTicketsCronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
    <property name="jobDetail" ref="recallTicketsJobDetailQuartz"/>
    <property name="cronExpression" value="00 01 0 * * ?"/>
    </bean>
    
    <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
    <property name="triggers">
    <list>
    <ref bean="indexTriggerQuartz" />
    <ref bean="expireTicketsCronTrigger" />
    <ref bean="archiveTicketsCronTrigger" />
    <ref bean="sendTicketReportsCronTrigger" />
    <ref bean="sendFaqReportsCronTrigger" />
    <ref bean="recallTicketsCronTrigger" />
    </list>
    </property>
    </bean>
    
    </beans>