Handling Multiple jobs

22 views
Skip to first unread message

Basil Babu

unread,
Jan 20, 2020, 10:42:05 AM1/20/20
to Quartz.NET
Hi, 

I am new to Quartz.

I am using Quartz for scheduling. The program is to perform different jobs at different times. 
For example,

There are 4 jobs, Job1, Job2, Job3, and  Job4.
Job1: runs daily at 10 am
Job2: runs every Sunday at 1 pm  
Job3: runs weekly on  Monday at 2 pm
Job4: runs on 2nd of every Montlyat 11 pm


how this can be implemented.

Mark Gillen

unread,
Jan 20, 2020, 11:48:09 AM1/20/20
to quar...@googlegroups.com, Basil Babu
Basil,

Quite easily done with cron triggers.

Set up the jobs.
Set up the cron triggers ( http://www.cronmaker.com/ is handy for generating cron expressions such as what you want). And specify the job.

That's it.

Best Regards,
Mark Gillen
--
You received this message because you are subscribed to the Google Groups "Quartz.NET" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quartznet+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quartznet/522b9ee6-5fce-41ae-bd8e-736d951c972a%40googlegroups.com.

 

xande...@gmail.com

unread,
Jan 20, 2020, 1:04:11 PM1/20/20
to quar...@googlegroups.com

Hi,

First you implement the Job you want to execute in a C# class.

So if you do a lot of different stuff you must implement many of that.

    public class MyJob : IJob

    {

Second, you use the JobBuild to create the JobDetail that is the prepared object to run the job.

IJobDetail job = JobBuilder.Create<MyJob>()


Third you create the TRIGGER with the schedule you need.

ITrigger trigger = TriggerBuilder.Create()

                                    .WithCronSchedule(/* Check docs to know how to make the schedule you need */)

                                    .Build();

And Forth and last you tell the Scheduler what job (detail) you want to run when (trigger):

await scheduler.ScheduleJob(job, trigger);

And of course, you must before that all create the “scheduler”:

StdSchedulerFactory factory =
new StdSchedulerFactory();

scheduler = await factory.GetScheduler();

And after configure it all executes scheduler.Start();

Best regards,

Alexandre Américo Fumes.

 

--

Bhumika

unread,
Jan 20, 2020, 8:29:51 PM1/20/20
to quar...@googlegroups.com
Job1: runs daily at 10 am  -> 0 0 10 ? * * 
Job2: runs every Sunday at 1 pm  -> 0 0 13 ? * SUN *
Job3: runs weekly on  Monday at 2 pm  ->  0 0 14 ? * MON *
Job4: runs on 2nd of every Montlyat 11 pm -> 0 0 23 ? * 2#2

check expression in :




--

Basil Babu

unread,
Jan 21, 2020, 12:06:42 AM1/21/20
to Quartz.NET
Hi, 

I do have another set of doubts...


if I need to perform 5 different tasks at 5 different times say..

Job1 to send an email that runs daily at 10 am

Job2 to open calculator that runs every Sunday at 1 pm  

Job3 to open an application(console) weekly on  Monday at 2 pm

Job4 to send mails to email id from a field of table in a database on 2nd Monday at 11 pm of every month.


Also is it possible to store the information about a job in quartz itself?(i found something about JOBDATAMAP).


If I need to get the triggering information and job information from the database how it can be implemented?


Thank you....


To unsubscribe from this group and stop receiving emails from it, send an email to quar...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages