Rescheduling jobs

294 views
Skip to first unread message

BKerwin

unread,
Dec 12, 2008, 11:39:48 AM12/12/08
to Quartz.NET
Hi,

I have an application that on startup reads a database and creates X
jobs and triggers from info in the db (cron schedule stored in
database), adds them to a scheduler and then starts the scheduler.
There is also a web interface (separate app) to allow users to change
the schedule for each job. My question is what is the best way to
check if the schedule has changed when a job/trigger fires and update
to use the new schedule? I am guessing I need to do something with a
ITriggerListener or IJobListener but I'm not sure the best approach.
Any help would be very appreciated.

Swordfish

unread,
Dec 16, 2008, 3:25:13 AM12/16/08
to Quartz.NET
Hi,

I also looking for this. I have a window service and web interface.

I have 5 mins interval for service to check the db and reschedule the
jobs unless job is not running.

my problem is that i can't find the job previously scheduled.

Please help..

Thanks,
Alex

the.ema...@gmail.com

unread,
Dec 23, 2008, 12:55:25 PM12/23/08
to Quartz.NET
Hii..

That is exactly what i am looking for.

I've read something like SqlDependency, but I'm not sure how to use
it.

Can you please help me to achieve the first step you have performed,
scheduling the task from the db?

Carsten Dressler

unread,
Jan 9, 2009, 9:29:05 PM1/9/09
to Quartz.NET
Why are you doing all this separate database stuff? Why not let the
web interface connect to the scheduler through remoting and setup the
scheduler to be persistent? Quartz.NET supports this out of the box.

Marko Lahma

unread,
Jan 10, 2009, 5:22:22 AM1/10/09
to quar...@googlegroups.com
Hi,

Yes, as Carsten pointed out it's possible to have different
installations of Quartz that can be used to handle the scheduling of
jobs. Quartz will always check database periodically for the next jobs
to run so running schedulers don't need to be explicitly made aware of
changes.

I think there's a need to make a sample of this scenario. There's
already the windows service but the web app wouldn't hurt either. Lets
see how we could organize this effort.

Cheers,

-Marko

Carsten Dressler

unread,
Jan 10, 2009, 7:40:07 PM1/10/09
to Quartz.NET
What kind of sample do you exactly mean?

A sample where you have a scheduler thats persistent with remoting
enabled? Then a web interface that talks to the scheduler through
remoting? Is this what kind of sample web app you mean?


On Jan 10, 5:22 am, "Marko Lahma" <marko.la...@gmail.com> wrote:
> Hi,
>
> Yes, as Carsten pointed out it's possible to have different
> installations of Quartz that can be used to handle the scheduling of
> jobs. Quartz will always check database periodically for the next jobs
> to run so running schedulers don't need to be explicitly made aware of
> changes.
>
> I think there's a need to make a sample of this scenario. There's
> already the windows service but the web app wouldn't hurt either. Lets
> see how we could organize this effort.
>
> Cheers,
>
> -Marko
>
> On Sat, Jan 10, 2009 at 4:29 AM, Carsten Dressler
>

Marko Lahma

unread,
Jan 11, 2009, 4:10:46 AM1/11/09
to quar...@googlegroups.com
Something along the lines you described. Scheduling with web app using
database back-end, remoting needs to be introduced if users were to
control the running states of schedulers also (this would actually
require some scheduler server registration options to web app or
network discovery).

Cheers,

-Marko

Cesar Sanz

unread,
Jan 12, 2009, 10:09:44 AM1/12/09
to quar...@googlegroups.com
Hi.

Thanks for this tips.

How can I connect my web interface with the scheduler database using
remoting?
Can you provide me some samples, or a place where I can find any
documentation?

I think your approach is the best, I've already programmed some of this:

1. A database with jobs information that notify my application (this
notification is made with SqlDependency) when a change occurred to the job's
table
2. A window service that on startup initialize all the jobs found in the
database and suscribe to DB events.

Thanks in advance.

Cesar Sanz

unread,
Jan 12, 2009, 10:30:03 AM1/12/09
to quar...@googlegroups.com
Hi, IMHO this is a topic that everybody is interested in.

I have the same requirements that you have,

I need a way to allow users to manage jobs, by this i mean:

** Add / Delete / Modify Jobs

In order to do that i need to create this projects:

1. Web interface (No idea how it will look like (Help Please!!)) to manage
jobs
2. Window service to perform the jobs
3. A database as a back end

If you have any example about the user interface it will be great.
I've found this, but it dont fullfill my expectations
http://www.codeproject.com/KB/vb/WebJobScheduler.aspx

Marko Lahma

unread,
Jan 12, 2009, 10:38:21 AM1/12/09
to quar...@googlegroups.com
Hi,

I totally agree that we need a web application sample for Quartz.
There's one in Java land and I can probably create a similar one with
ASP.NET MVC (.NET 3.5 only, thoughts?). I'm also more than willing to
accept community contributions.

The general idea to handle the scenario is:

* 1-n web app installation(s) to handle administrative tasks via web
interface and ZeroSizeThreadPool (no jobs run here)
* 1-n windows service installation(s) to run the jobs (clustering/load
balancing)

This can be achieved using just the plain DB back-end. If we want to
control running states of schedulers we also need remoting / UDP
broadcasts.

Cheers,

-Marko

Cesar Sanz

unread,
Jan 12, 2009, 10:59:10 AM1/12/09
to quar...@googlegroups.com
Hi,

I have a quartz ebook for java, and there is a sample web application,
Do we refers to the same example or can you give me some links to
explore the examples.

P.S: The application I've created are working fine, but i think they are NOT
well designed.

Kyle Leneau

unread,
Jan 12, 2009, 11:04:19 AM1/12/09
to quar...@googlegroups.com
Marko,

I have looked into this a bit and was wondering about the API.  Could the web application execute methods or objects in the current quartz API that would schedule jobs (i.e. write the metadata to DB or XML).  Or would this writing/scheduling of jobs have to be down by some type of service/provider that the web application consumes?  If there are a layer/assemblies of configurable services than they could be hosted or consumed by more than just applications, there could be a WPF app.

I think an amazing example of scheduling jobs for a web applications is Jet Brains TeamCity.  They have a lot of cool features that would be nice to have.  Anyone interested more in the persuit of an open source project like this.

-Kyle

Marko Lahma

unread,
Jan 12, 2009, 11:07:53 AM1/12/09
to quar...@googlegroups.com
> I have a quartz ebook for java, and there is a sample web application,
> Do we refers to the same example or can you give me some links to
> explore the examples.

Current trunk for Java web-app:
http://svn.opensymphony.com/svn/quartz/webapp/trunk/

-Marko

luke adams

unread,
Jan 12, 2009, 11:09:01 AM1/12/09
to quar...@googlegroups.com
Not Marko but I would assume creating a web/windows interface would be pretty straight forward.  I would imagine the trickiest part is hooking up to the scheduler instance.  But it would be very easy to create a WCF service inside your scheduler service that gave you access to the instance.  Then the front end could communicate through this.

Marko Lahma

unread,
Jan 12, 2009, 11:11:58 AM1/12/09
to quar...@googlegroups.com
Hi Kyle,

The current API can be used by the web-application. It just needs to
be pointed to the Quartz database and then the scheduling can be
persisted there. This is the easiest way to do it without introducing
abstractions. If you need to abstract away from Quartz then it's a
different story.

If I remember right TeamCity uses Java Quartz behind the scenes, as
does Atlassian's Bamboo solution.

-Marko

Marko Lahma

unread,
Jan 12, 2009, 11:13:59 AM1/12/09
to quar...@googlegroups.com
There's a remoting exporter bundled with Quartz that allows remote
access to API, you can also create your own exporter that uses WCF if
you wish. The remote interface is needed if you need to start or stop
the scheduler or set it to standby mode. Otherwise DB should suffice.

-Marko

Kyle Leneau

unread,
Jan 12, 2009, 11:14:51 AM1/12/09
to quar...@googlegroups.com
Guess I have never thought of this but why would you want access to the scheduler instance itself?  Just to schedule jobs you need to write something to the DB or XML...  Unless you want to control or know status of running jobs.  You'd then have to have a more complex instance than the example.

-Kyle

luke adams

unread,
Jan 12, 2009, 11:17:20 AM1/12/09
to quar...@googlegroups.com
Thats what I meant if you wanted access to a running scheduler.  But as marko said there is a remoting interface.

Kyle Leneau

unread,
Jan 12, 2009, 11:18:43 AM1/12/09
to quar...@googlegroups.com
Marko,

Does the API provide methods to get all the jobs or search for jobs in a sort of array of list fashion?

How about database compatibility?  What are the current supported DB's?

-Kyle

Cesar Sanz

unread,
Jan 12, 2009, 11:21:50 AM1/12/09
to quar...@googlegroups.com
Hi,
 
I imagine this scenerio like follows:
 
------------------------------                                         ---------------------------------------------                               ----------------------------------------------
|                            |                                          |                                          |                                 |                                           |
|    Web Interface    | ---------- writes to --------------> |    DataBase, Persited Jobs  Í  <------ reads from ---   |    WinService, Perform Jobs  |
|                            |                                          |                                          Í                                 |                                            |
-----------------------------                                         ---------------------------------------------                                -----------------------------------------------
 
I mean:
 
- a web Interface is the place that the user can manage all jobs, the web interface, add/deletes/modify jobs
- the winservice reads jobs from database and execute them accordingly
 
----- Original Message -----

Marko Lahma

unread,
Jan 12, 2009, 11:25:47 AM1/12/09
to quar...@googlegroups.com
> Does the API provide methods to get all the jobs or search for jobs in a
> sort of array of list fashion?

http://quartznet.sourceforge.net/apidoc/topic37.html#MethodsBookmark

You can get the names of all jobs and then get the job details.

> How about database compatibility? What are the current supported DB's?

Currently supported databases are:

Firebird
MySQL
Oracle
Postgres
SQLite
SQL Server

Others can be supported, Java version supports many others but
currently it's limited to db availability to testing and the time I
have to test.

Kyle Leneau

unread,
Jan 12, 2009, 11:26:03 AM1/12/09
to quar...@googlegroups.com
Hello,

Right, according to Marko the writing of jobs and reading jobs can be facilitated through the Quartz.Net API.  No intermediate service/provider layer needs to know how to write to the Database.  I agree, this is the simplest approach.

-Kyle

Kyle Leneau

unread,
Jan 12, 2009, 11:26:03 AM1/12/09
to quar...@googlegroups.com
Hello,

Right, according to Marko the writing of jobs and reading jobs can be facilitated through the Quartz.Net API.  No intermediate service/provider layer needs to know how to write to the Database.  I agree, this is the simplest approach.

-Kyle

Carsten Dressler

unread,
Jan 12, 2009, 9:57:42 PM1/12/09
to Quartz.NET
I have a simple VB 2008 project which exists of two projects:

1. Host - Console Application - with persistence and with remoting
enabled
2. Client - Console Application - Connects to the Host through
remoting, and schedules job.

It will be very simple to change the Host into a Windows Service
(although same principle, just easier to test as console app). In my
production application I have the Host as a Windows Service and the
Client is a WPF Application. I might (probably will) rewrite my WPF
Client so that it works in SilverLight 2.0. However, I dont know if
remoting works that easily in a SilverLight application.

I think the Remoting Samples is pretty straightforward. Two things
missing on the sample applications were the following:

1. Database Persistence (had a buddy tell me how to enable it...).
2. Direct Database Modifications (Didnt know that was an option, so I
used remoting).

Has anyone begun creating code for this? Like I said, I will probably
rewrite my Client into SilverLight 2.0 that connects directly to the
DB to modify/create the schedules. If someone has a start that would
be welcome.

Carsten

On Jan 12, 10:38 am, "Marko Lahma" <marko.la...@gmail.com> wrote:
> Hi,
>
> I totally agree that we need a web application sample for Quartz.
> There's one in Java land and I can probably create a similar one with
> ASP.NET MVC (.NET 3.5 only, thoughts?). I'm also more than willing to
> accept community contributions.
>
> The general idea to handle the scenario is:
>
> * 1-n web app installation(s) to handle administrative tasks via web
> interface and ZeroSizeThreadPool (no jobs run here)
> * 1-n windows service installation(s) to run the jobs (clustering/load
> balancing)
>
> This can be achieved using just the plain DB back-end. If we want to
> control running states of schedulers we also need remoting / UDP
> broadcasts.
>
> Cheers,
>
> -Marko
>

Marko Lahma

unread,
Jan 13, 2009, 5:36:45 AM1/13/09
to quar...@googlegroups.com
I probably will start playing with ASP.NET MVC (learning experience
for me) and try to create a more complete sample with web admin
interface, database and clustering etc. No dates can be given as I
can't yet quit my day job with all these open source incomes ;-)

-Marko

Cesar Sanz

unread,
Jan 13, 2009, 9:42:23 AM1/13/09
to quar...@googlegroups.com
Hello Carsten, this is very interesting, I've have never tried this.
Can somebody help me how to:

1. Set up Quartz.Net to work with Remoting
2. Send messages from a client app through remoting

>I think the Remoting Samples is pretty straightforward. Two things
>missing on the sample applications were the following:

>1. Database Persistence (had a buddy tell me how to enable it...).
>2. Direct Database Modifications (Didnt know that was an option, so I
>used remoting).

I've read that you can manipulate your database backend directly with a web
app.
Marko gave me a link where you can find a web application written in Java
(Struts 2.X) that modifies the database.
I was not able to compile it, but I found a link where you can download de
compiled version and just
deploye it (I deployed it in a Tomcat server) and use it.

You can take a look:
http://wiki.opensymphony.com/display/QRTZ1/QuickStart

By the way, how make you work your example with remoting, can you help me.

Thanx,

----- Original Message -----
From: "Carsten Dressler" <carsten....@gmail.com>

Carsten Dressler

unread,
Jan 13, 2009, 10:16:38 AM1/13/09
to Quartz.NET
The Remoting is rather simple. Create an application that hosts
Quartz.NET and add this to the config file (or add programmically the
configs):

<add key="quartz.scheduler.exporter.type"
value="Quartz.Simpl.RemotingSchedulerExporter, Quartz" />
<add key="quartz.scheduler.exporter.port" value="555" />
<add key="quartz.scheduler.exporter.bindName"
value="QuartzScheduler" />
<add key="quartz.scheduler.exporter.channelType" value="tcp" />

On the client side, simply add the following in either the config file
or add it programmically:

Dim properties As New NameValueCollection
properties("quartz.scheduler.instanceName") = "FMSystem"

'set remoting expoter
properties("quartz.scheduler.proxy") = "true"
properties("quartz.scheduler.proxy.address") = "tcp://dai-
fmdserver.dai.cosma.com:555/QuartzScheduler"

sched = New RemoteQuartz(properties)

Now you can work with Quartz as if it was running locally.

I put together a sample that demostrates this in VB. I can post it
when I get home tonight.

Carsten

Cesar Sanz

unread,
Jan 13, 2009, 10:33:40 AM1/13/09
to quar...@googlegroups.com
Ok.. I'll give it a try to this.

But I have another question. My purpose is to be able to reschedule jobs
from another application.
Do you persists your jobs in database using ADO or RAMJobStore?

How come is that you store jobs into the database?
I've already set up my database schema but there is no way to fill those
tables..

I've read that when you start Quartz, it reads jobs from the database, but,
how do you first setup this jobs?

Regards.
----- Original Message -----
From: "Carsten Dressler" <carsten....@gmail.com>
To: "Quartz.NET" <quar...@googlegroups.com>

Carsten Dressler

unread,
Jan 13, 2009, 10:57:50 AM1/13/09
to Quartz.NET
Setting up Quartz to store all changes in a DB is very simple. I am
using Microsoft SQL Server for this. On the application that hosts
Quartz add the following to the config file or add programmatically:

<add key="quartz.jobStore.type"
value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" />
<add key="quartz.jobStore.driverDelegateType"
value="Quartz.Impl.AdoJobStore.StdAdoDelegate, Quartz" />
<add key="quartz.jobStore.lockHandler.type"
value="Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz" />
<add key="quartz.jobStore.tablePrefix" value="QRTZ_" />
<add key="quartz.jobStore.dataSource" value="myDS" />
<add key="quartz.dataSource.myDS.connectionString"
value="Server=xxx.com;Database=db_name;Uid=username;Pwd=password" />
<add key="quartz.dataSource.myDS.provider" value="SqlServer-20" />

You'll have to adjust the SqlServer-20 according to your database.
Read here for a list of all support DB Servers:
http://quartznet.sourceforge.net/tutorial/lesson_9.html



Carsten

Cesar Sanz

unread,
Jan 13, 2009, 11:22:26 AM1/13/09
to quar...@googlegroups.com
Hi..

Thanx for replying... My real questions are:

How do you fill the database with jobs? I mean, initially.
How does Quartz.Net is aware that there are jobs in the database.

How do you insert that jobs.?
how do you creates them and stores them into the database firstly?

Did you create a front end for scheduling jobs?

slt.

Cesar Sanz

unread,
Jan 14, 2009, 9:58:53 AM1/14/09
to quar...@googlegroups.com
Hello,

I was studying the database schema provided by Quartz.Net to persist jobs,
and I found
some fields that have an 'image' type.

My question is, how do yo persist this fields (for instance JOB_DATA field)
?

Some one of you have a little example of persisting jobs from any user
interface?

Regards

James

unread,
Jan 29, 2009, 1:11:39 PM1/29/09
to Quartz.NET
Here's another vote for a web management interface in Quartz.NET!

Be sure to let us know as soon as there is a beta version avaliable,
I'll happily test it for you ;-)

Cheers,
James Fitzsimons
> >> >>>> >> Any help would be very appreciated.- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages