Question

I want to be able to :

  • define different jobs and triggers.
  • modify the expirations dates and intervals on demand
  • pause or cancel an execution (trigger)

the jobs would be ejbs or call ejbs and i would want to manage everything from the website (the user will have to define the executions)

So i looked at the timerservice, timerobjects, timer and timerhandle. But i think it can't answer to all my needs

Quartz, on the other hand, allows me to do every thing that i want, but i haven't the slightest clue on how to integrate this into my jboss. I read that quartz uses its own threadpool, and i don't know how to handle all this.

I use Jboss Seam in my project, but the seam/quartz integration is very limited (or the documentation is) and not 100% safe (seen on their forum : 'run forever' tasks end after only a few weeks)

If someone managed to integrate a good scheduler into his application server (jboss is a plus) and could give me directions, advices, or even code snippets, i would be thrilled.

Thanks in advance.

Was it helpful?

Solution 3

Ok, i am sorry, i found in the sources of Jboss Seam just what i needed : QuartzDispatcher to create QuartzTriggerHandle wich fires seam event at specified time and date and is manually pausable, resumable and stoppable. I use an @observer on the method i wanted to execute.

It's simple, and it works so far.

OTHER TIPS

I have some experience integrating Quartz into a Weblogic (no jboss experience, sorry) application server. Quartz has a built in listener class that will be called upon server startup (per J2EE specs) that automatically configure the Quartz scheduler. Then in another startup class you can retrieve that scheduler, add jobs and begin serving those jobs.

You generally don't need to worry about the threadpool, Quartz can handle all this itself if you want it too. It gets its information from a properties files on startup that you can define or use the default one that comes with quartz. I have been using the default because it works for my purposes.

As far as defining jobs, you create your job classes and call your ejbs from there. It is rather very simple.

For your reading pleasure:

All Quartz documentation

Quartz JavaDoc

Cookbook containing lots of code snippets

Hope that's enough to get you started!

Great news! JBoss has a built-in scheduler already.

Since the EJB 2.0 specification included running stateless session beans and MDBs at scheduled intervals, all application servers have included this capability for some time now.

Here is an example of configuring JBoss to run a class using its built-in scheduler:

http://www.jboss.org/community/wiki/Scheduler

The best part about JBoss' implementation is that it is based on the MBean specification, which means that you can create/update/delete scheduled tasks at runtime.

As pointed out by Poindexter, the Quartz documentation has nice starting points: Tutorial for Developing with Quartz, Examples of Usage, Cook Book (Quick How-Tos in the form of code examples), etc.

The What Is Quartz article is really good too (even if a bit old now).

For integration with JBoss, maybe have a look at How to configure a Quartz service on JBoss Wiki.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top