Re: Adding a scheduled job, besides the NotificationManager
"Jorge Uriarte Aretxaga" <[email protected]>
| Newsgroups | gmane.comp.java.scarab.user |
|---|---|
| Message-ID | <[email protected]> |
Hendrik;
sorry for the delay.
You're right in that quartz's fulcrum wrapper doesn't seem to be so
documented.
I think you were still missing a variation in the configuration file,
though.
Seems like quartz definition is somethin like:
quartz
scheduled+
jobDetails
list
jobDetail+
triggers
list
trigger+
Take a look at the fragment below; I've just doubled every xml section in
the proper sequence, but the notification.log seems to report the correct
behaviour:
<quartz>
<scheduled jobName="NotificationManagerJob" jobGroup="Scarab"
triggerName="NMTrigger" triggerGroup="Scarab"/>
<scheduled jobName="NotificationManagerJob2" jobGroup="Scarab"
triggerName="NMTrigger2" triggerGroup="Scarab"/>
<jobDetails>
<list>
<org.quartz.JobDetail>
<name>NotificationManagerJob</name>
<group>Scarab</group>
<jobClass>
org.tigris.scarab.notification.NotificationManagerJob</jobClass>
<volatility>false</volatility>
<durability>true</durability>
<shouldRecover>false</shouldRecover>
<jobListeners/>
</org.quartz.JobDetail>
</list>
</jobDetails>
<jobDetails>
<list>
<org.quartz.JobDetail>
<name>NotificationManagerJob2</name>
<group>Scarab</group>
<jobClass>
org.tigris.scarab.notification.NotificationManagerJob</jobClass>
<volatility>false</volatility>
<durability>true</durability>
<shouldRecover>false</shouldRecover>
<jobListeners/>
</org.quartz.JobDetail>
</list>
</jobDetails>
<triggers>
<list>
<org.quartz.CronTrigger>
<name>NMTrigger</name>
<group>Scarab</group>
<cronExpression>0 38,39,42,43 * * * ?</cronExpression>
<description>Launches the NM every minute</description>
<jobName>NotificationManagerJob</jobName>
<jobGroup>Scarab</jobGroup>
</org.quartz.CronTrigger>
<org.quartz.CronTrigger>
<name>NMTrigger2</name>
<group>Scarab</group>
<cronExpression>0 39,40,41,42,43 * * * ?</cronExpression>
<description>Launches the NM every minute</description>
<jobName>NotificationManagerJob</jobName>
<jobGroup>Scarab</jobGroup>
</org.quartz.CronTrigger>
</list>
</triggers>
</quartz>
On 1/23/08, Loeher, Hendrik <[email protected]> wrote:
>
> Hello Reader.
>
> How can i add another job in quartz?
> The thing is, if i set up the TestJob on top off the NotificationManager
> (in the following file), quartz will execute only the "TestJob" class!
> If i set it up in the following order, the NotificationManager will start,
> but not the Testjob!
> I have modified the componentConfiguration.xml this way:
>
> <quartz>
> <scheduled jobName="NotificationManagerJob" jobGroup="Scarab"
> triggerName="NMTrigger" triggerGroup="Scarab"/>
> <jobDetails>
> <list>
> <org.quartz.JobDetail>
> <name>NotificationManagerJob</name>
> <group>Scarab</group>
> <jobClass>
> org.tigris.scarab.notification.NotificationManagerJob</jobClass>
> <volatility>false</volatility>
> <durability>true</durability>
> <shouldRecover>false</shouldRecover>
> <jobListeners/>
> </org.quartz.JobDetail>
> </list>
> </jobDetails>
> <triggers>
> <list>
> <org.quartz.CronTrigger>
> <name>NMTrigger</name>
> <group>Scarab</group>
> <cronExpression>* * * * * ?</cronExpression>
> <description>Launches the NM every minute</description>
> <jobName>NotificationManagerJob</jobName>
> <jobGroup>Scarab</jobGroup>
> </org.quartz.CronTrigger>
> </list>
> </triggers>
> <scheduled jobName="TestJob" jobGroup="Scarab"
> triggerName="TTrigger" triggerGroup="Scarab"/>
> <jobDetails>
> <list>
> <org.quartz.JobDetail>
> <name>TestJob</name>
> <group>Scarab</group>
> <jobClass>org.tigris.scarab.notification.TestJob
> </jobClass>
> <volatility>false</volatility>
> <durability>true</durability>
> <shouldRecover>false</shouldRecover>
> <jobListeners/>
> </org.quartz.JobDetail>
> </list>
> </jobDetails>
> <triggers>
> <list>
> <org.quartz.CronTrigger>
> <name>TTrigger</name>
> <group>Scarab</group>
> <cronExpression>* * * * * ?</cronExpression>
> <description>Launches the NM every minute</description>
> <jobName>TestJob</jobName>
> <jobGroup>Scarab</jobGroup>
> </org.quartz.CronTrigger>
> </list>
> </triggers>
> </quartz>
>
> In the quartz.properties i set that:
> org.quartz.threadPool.threadCount = 10
>
> And the TestJob.java in the notification folder:
> package org.tigris.scarab.notification;
>
> /* ================================================================
> * Copyright (c) 2000-2005 CollabNet. All rights reserved.
> * ====================================================================
> *
> * SNIPP *
> *
> * This software consists of voluntary contributions made by many
> * individuals on behalf of CollabNet.
> */
>
> import java.sql.Time;
>
> import org.apache.log4j.Logger;
> import org.quartz.JobExecutionContext;
> import org.quartz.JobExecutionException;
> import org.quartz.SchedulerException;
> import org.quartz.Job;
> import org.tigris.scarab.util.Log;
>
> public class TestJob implements Job {
> public static Logger log = Log.get(TestJob.class.getName());
>
> /**
> * Executes the process that send the pending notifications.
> */
> public void execute(JobExecutionContext jobContext) throws
> JobExecutionException {
> log.info("Test startet!");
> }
> }
> What to do? I'm totaly confused, found no more quartz files...
>
> Many thanks for helping!
> Hendrik
>