Example of daily trigger in XML configuration

1,922 views
Skip to first unread message

Daniel

unread,
Oct 10, 2011, 3:40:33 AM10/10/11
to Quartz.NET
Hi,

how can I configure daily trigger in XML configuration file.
Just can't find any examples about XML config. It is pretty easy to do
by coding in c#, but the question is how I can configure by XML file.


// fire every day at 08:00
Trigger trigger2 = TriggerUtils.MakeDailyTrigger(8, 0);
// begin immediately
trigger.StartTimeUtc = DateTime.UtcNow;
trigger2.Name = "myTrigger2";

The purpose is very clean - configure daily job that will run at 2:00.

Thanks a lot.

Nuno Maia

unread,
Oct 10, 2011, 9:39:49 AM10/10/11
to quar...@googlegroups.com
Hi,
As far as I know, the settings from Simple Trigger are Interval,
RepeatCount and Misfire Instruction. You can set interval for 24
hours, but I don’t see a way to set start time.
SimpleScheduleBuilder.Create()
.WithInterval([Value])
.WithRepeatCount([repeatCount]);
WithMisfireHandlingInstruction([repeatCount])

I would use XML settings from Cron Trigger for your purpose.

> --
> You received this message because you are subscribed to the Google Groups "Quartz.NET" group.
> To post to this group, send email to quar...@googlegroups.com.
> To unsubscribe from this group, send email to quartznet+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/quartznet?hl=en.
>
>

Arik Maor

unread,
Oct 10, 2011, 11:04:46 AM10/10/11
to Quartz.NET
Hi,
Managed to achieve this by using a cron trigger definition:
<trigger>
<cron>
<name>triggerName</name>
<group>triggerGroup</group>
<job-name>jobName</job-name>
<job-group>jobGroup</job-group>
<cron-expression>0 30 18 ? * *</cron-expression>
</cron>
</trigger>
this will trigger every day at 18:30:00

Jay Vilalta

unread,
Oct 10, 2011, 11:32:57 AM10/10/11
to quar...@googlegroups.com
It seems you are using version 1... if that is the case, below is an example of a cron trigger xml config. 

I think the cron expression there will work for what you want, but I did not test it so I can't be sure. If you need more details, I wrote a post about configuring jobs with xml in version 1 a while back. Here's the link: http://jvilalta.blogspot.com/2009/04/getting-started-with-quartznet-part-3.html

<trigger>
<cron>
<name>PayrollProcessorTrigger</name>
<group>Payroll</group>
<description>Trigger payroll</description>
<misfire-instruction>SmartPolicy</misfire-instruction>
<volatile>false</volatile>
<job-name>PayrollProcessor</job-name>
<job-group>Payroll</job-group>
<cron-expression>0 0 2 * * ?</cron-expression>
</cron>
</trigger>


Daniel Pashkov

unread,
Oct 10, 2011, 11:45:04 AM10/10/11
to quar...@googlegroups.com
Thanks a lot.

This is exactly what we need.
I am happy to know that the community is alive!


Daniel
Reply all
Reply to author
Forward
0 new messages