Hi Scott,

I have idea about implementing Quartz Job Store in an application.

Quartz is a open source job scheduling framework written entirely in Java.
It can be integrated with, or used along side virtually any J2EE or J2SE
application - from the smallest stand-alone application to the largest
e-commerce system.
It performs operations like scheduling jobs, unscheduling jobs
starting/stopping/pausing the scheduler.

We can schedule jobs, by implement the Job interface which override the
execute() method. TriggerListener or JobListener interface are also used.

Maven Dependencies needed:
<dependency>
    <groupId>org.opensymphony.quartz</groupId>
    <artifactId>quartz</artifactId>
    <version>1.6.1</version>
</dependency>

<!-- Quartz dependency library-->
<dependency>
    <groupId>commons-collections</groupId>
    <artifactId>commons-collections</artifactId>
    <version>3.2.1</version>
</dependency>

There are few necessary tables used in Quartz Scheduler that are need to be
created on startup:

QRTZ_BLOB_TRIGGERS
QRTZ_CALENDARS
QRTZ_CRON_TRIGGERS
QRTZ_FIRED_TRIGGERS
QRTZ_JOB_DETAILS
QRTZ_JOB_LISTENERS
QRTZ_LOCKS
QRTZ_PAUSED_TRIGGER_GRPS
QRTZ_SCHEDULER_STATE
QRTZ_SIMPLE_TRIGGERS
QRTZ_TRIGGERS
QRTZ_TRIGGER_LISTENERS

Lets say we want to schedule job after every 2 minutes in offline mode then:
1) We can have TRIGGER_NAME filed value 'TR_OfflineProcess' & JOB_NAME field
value say 'JB_OfflineProcess' in QRTZ_TRIGGERS table.
2) Have JOB_NAME filed value 'JB_OfflineProcess' in QRTZ_JOB_DETAILS table.
3) Have CRON_EXPRESSION filed value '0 0/2 * * * ? *' against trigger
'TR_OfflineProcess' in QRTZ_CRON_TRIGGERS table.

Inorder to schedule Jobs, we need to first start the scheduler on server
start up, for that we use org.quartz.impl.StdSchedulerFactory class which
takes required quartz properties & returns scheduler object. Then we can add
trigger listeners to the scheduler & start scheduler by scheduler.start();
method.

We can use methods for scheduling provided in a org.quartz.Scheduler class:
scheduler.pauseJob();
scheduler.resumeJob();
scheduler.unscheduleJob();
scheduler.rescheduleJob();
scheduler.getTrigger();
scheduler.shutdown();


-- 
Thanks & Regards,
Pankaj Savita
Mob: +91 9890262476
Mail to: [email protected]




On Wed, Oct 20, 2010 at 5:29 AM, Scott Gray <[email protected]>wrote:

> On 20/10/2010, at 12:50 PM, BJ Freeman wrote:
>
> >
> >
> >
> > =========================
> > BJ Freeman
> > Strategic Power Office with Supplier Automation  <
> http://www.businessesnetwork.com/automation/viewforum.php?f=52>
> > Specialtymarket.com  <http://www.specialtymarket.com/>
> > Systems Integrator-- Glad to Assist
> >
> > Chat  Y! messenger: bjfr33man
> > Scott Gray sent the following on 10/19/2010 2:29 PM:
> >> On 20/10/2010, at 3:31 AM, BJ Freeman wrote:
> >>
> >>> I would like to balance that with the ability to modify code as need
> arises. especially when doing vertical markets.
> >>
> >> Your ability to modify the source code is not diminished, if you really
> want to you just download the quartz open source and recompile it with your
> mods.
> >>
> >>> One of the reasons I don't like Opentaps is I have to learn all these
> outside systems besides what is in ofbiz.
> >>
> >> That is an example of technology bloat, which is different from what I'm
> suggesting here.  OFBiz is going to have a job manager whether it is our
> code or someone else's doesn't reduce the need to learn it.  Quartz does
> however offer better documentation and learning it has a good chance of
> being useful for non-OFBiz projects.
> >
> >>
> >>> Seems to me we have a project manager that would fit into this.
> >>
> >> You lost me here.
> >
> > there is two ways to go
> > 1) you can implement the project manager to create Jobs and monitor the
> progress based on estimated. Once the Job goes out of spec the project
> manager can show the best way to make a decision on how to get back on track
> and create the jobs to do that.
> > This is part of ERP where Positions are created for HR, through the Work
> effort.
> > Since we have the frame work for production runs this would take less
> design and integration time in my opinion.
> >
> > 2)when Jobs are created they create a Project that can be tracked as in
> #1.
>
> I think you're misunderstanding what the JobManager and Quartz Scheduler
> do.  This discussion is about managing persisted async service calls i.e.
> low level framework stuff.
>
> >
> >>
> >>> as a matter of fact that was my goal years ago, on integrating an GNATT
> project into ofbiz. Problem was it used SWT.
> >>>
> >>> =========================
> >>> BJ Freeman
> >>> Strategic Power Office with Supplier Automation<
> http://www.businessesnetwork.com/automation/viewforum.php?f=52>
> >>> Specialtymarket.com<http://www.specialtymarket.com/>
> >>> Systems Integrator-- Glad to Assist
> >>>
> >>> Chat  Y! messenger: bjfr33man
> >>>
> >>>
> >>> Michael Xu (xudong) sent the following on 10/17/2010 6:45 PM:
> >>>> hi Scott,
> >>>>
> >>>> I don't know much about Quartz. But I really think it is the correct
> >>>> direction to migrate home-grown codes to mature third party solution
> or
> >>>> separate mature ofbiz components as standalone framework. As such, we
> can
> >>>> focus on value creation and furthermore it might help attract more
> >>>> developers to join.
> >>>>
> >>>> --
> >>>> Regards,
> >>>> Michael Xu (xudong)
> >>>>
> >>>>
> >>>> On Mon, Oct 18, 2010 at 5:28 AM, Scott Gray<
> [email protected]>wrote:
> >>>>
> >>>>> Hi All,
> >>>>>
> >>>>> I was looking at the Quartz Scheduler project (
> www.quartz-scheduler.org)
> >>>>> over the weekend and it looks like it could be a good fit for OFBiz.
>  We ran
> >>>>> into some issues with the scheduled service code in OFBiz recently
> where a
> >>>>> heavy server load would cause all sorts of strangeness (multiple
> reschedules
> >>>>> for a single failed job, inability to purge old jobs before a
> timeout, those
> >>>>> two combined eventually bringing the server to its knees), and my
> options
> >>>>> are to either find and fix the problem(s) or replace the scheduler
> with an
> >>>>> external solution.
> >>>>>
> >>>>> I've only had a brief look but it appears like quartz is pretty
> extensible
> >>>>> and would allow us to continue to support things like temporal
> expressions
> >>>>> (and the deprecated recurrence infos) and could probably increase the
> number
> >>>>> of scheduling features available to OFBiz.  It's ASL2 licensed and
> seems to
> >>>>> be pretty mature.
> >>>>>
> >>>>> Does anyone have any experience with quartz to share?  Opinions or
> other
> >>>>> possible alternatives would be most welcome.  I'm not looking to
> implement
> >>>>> anything anytime soon but figured we may as well start discussing it.
> >>>>>
> >>>>> Thanks
> >>>>> Scott
> >>>>>
> >>>>> HotWax Media
> >>>>> http://www.hotwaxmedia.com
> >>>>>
> >>>>>
> >>>>
> >>>
> >>
>
>

Reply via email to