You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Jeffery Painter <pa...@kiasoft.com> on 2003/08/06 23:17:33 UTC

Re: SchedulerService

I place my jobs in the database table TURBINE_SCHEDULED_JOB
and on every restart of turbine, the scheduler service does pick up the 
Task in the table entry

I created a package entry for all my scheduled services as such

    com.kiasoft.appname.modules.scheduledjobs.*

in my source tree.

mysql> select * from TURBINE_SCHEDULED_JOB;
+--------+--------+--------+------+----------+--------------+----------------------+---------------------+----------+
| JOB_ID | SECOND | MINUTE | HOUR | WEEK_DAY | DAY_OF_MONTH | 
TASK                 | EMAIL               | PROPERTY |
+--------+--------+--------+------+----------+--------------+----------------------+---------------------+----------+
|      1 |      0 |     30 |   -1 |       -1 |           -1 | 
NoticeAgent          | painter@kiasoft.com | NULL     |
+--------+--------+--------+------+----------+--------------+----------------------+---------------------+----------+
1 row in set (0.00 sec)

so this maps to com.kiasoft.appname.modules.scheduledjobs.NoticeAgent 
class file

check your TurbineResources.properties for the following entries

# pick up our private modules

module.packages=com.kiasoft.appname.modules

# AND

# -------------------------------------------------------------------
#
#  S C H E D U L E R  S E R V I C E
#
# -------------------------------------------------------------------
                                                                                                                                                             

#
# Set enabled to true to start the scheduler.
#
scheduler.enabled=true


I'm not exactly sure why this works or how scheduler knows to look for 
scheduledjobs in that particular class heirarchy as it has been a while 
since I wrote the scheduled service.. I just know that this is currently 
working for me.

I know that there is a way to also hard code your scheduled jobs to be 
picked up from the TurbineResources.properties file as well rather than 
the database entry but I never experimented with that route.

Thanks,

Jeff Painter
painter@kiasoft.com
                                                                                                                                                             



Konrad Rokicki wrote:

>What is the best place to put the code to add a job to the
>SchedulerService if I want it to run when the server starts?
>Thanks,
>Konrad Rokicki
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


RE: SchedulerService

Posted by Mitch Christensen <mi...@informatixinc.com>.
If you only want the process to run at startup, I would consider a creating
a Service.  This is much easier than it sounds, and provides simple hooks
into the Turbine lifecycle events (startup, shutdown, etc.)

-Mitch

-----Original Message-----
From: Jeffery Painter [mailto:painter@kiasoft.com]
Sent: Wednesday, August 06, 2003 2:18 PM
To: Turbine Users List
Subject: Re: SchedulerService



I place my jobs in the database table TURBINE_SCHEDULED_JOB
and on every restart of turbine, the scheduler service does pick up the
Task in the table entry

I created a package entry for all my scheduled services as such

    com.kiasoft.appname.modules.scheduledjobs.*

in my source tree.

mysql> select * from TURBINE_SCHEDULED_JOB;
+--------+--------+--------+------+----------+--------------+---------------
-------+---------------------+----------+
| JOB_ID | SECOND | MINUTE | HOUR | WEEK_DAY | DAY_OF_MONTH |
TASK                 | EMAIL               | PROPERTY |
+--------+--------+--------+------+----------+--------------+---------------
-------+---------------------+----------+
|      1 |      0 |     30 |   -1 |       -1 |           -1 |
NoticeAgent          | painter@kiasoft.com | NULL     |
+--------+--------+--------+------+----------+--------------+---------------
-------+---------------------+----------+
1 row in set (0.00 sec)

so this maps to com.kiasoft.appname.modules.scheduledjobs.NoticeAgent
class file

check your TurbineResources.properties for the following entries

# pick up our private modules

module.packages=com.kiasoft.appname.modules

# AND

# -------------------------------------------------------------------
#
#  S C H E D U L E R  S E R V I C E
#
# -------------------------------------------------------------------


#
# Set enabled to true to start the scheduler.
#
scheduler.enabled=true


I'm not exactly sure why this works or how scheduler knows to look for
scheduledjobs in that particular class heirarchy as it has been a while
since I wrote the scheduled service.. I just know that this is currently
working for me.

I know that there is a way to also hard code your scheduled jobs to be
picked up from the TurbineResources.properties file as well rather than
the database entry but I never experimented with that route.

Thanks,

Jeff Painter
painter@kiasoft.com




Konrad Rokicki wrote:

>What is the best place to put the code to add a job to the
>SchedulerService if I want it to run when the server starts?
>Thanks,
>Konrad Rokicki
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


RE: SchedulerService

Posted by Mitch Christensen <mi...@informatixinc.com>.
If you only want the process to run at startup, I would consider a creating
a Service.  This is much easier than it sounds, and provides simple hooks
into the Turbine lifecycle events (startup, shutdown, etc.)

-Mitch

-----Original Message-----
From: Jeffery Painter [mailto:painter@kiasoft.com]
Sent: Wednesday, August 06, 2003 2:18 PM
To: Turbine Users List
Subject: Re: SchedulerService



I place my jobs in the database table TURBINE_SCHEDULED_JOB
and on every restart of turbine, the scheduler service does pick up the
Task in the table entry

I created a package entry for all my scheduled services as such

    com.kiasoft.appname.modules.scheduledjobs.*

in my source tree.

mysql> select * from TURBINE_SCHEDULED_JOB;
+--------+--------+--------+------+----------+--------------+---------------
-------+---------------------+----------+
| JOB_ID | SECOND | MINUTE | HOUR | WEEK_DAY | DAY_OF_MONTH |
TASK                 | EMAIL               | PROPERTY |
+--------+--------+--------+------+----------+--------------+---------------
-------+---------------------+----------+
|      1 |      0 |     30 |   -1 |       -1 |           -1 |
NoticeAgent          | painter@kiasoft.com | NULL     |
+--------+--------+--------+------+----------+--------------+---------------
-------+---------------------+----------+
1 row in set (0.00 sec)

so this maps to com.kiasoft.appname.modules.scheduledjobs.NoticeAgent
class file

check your TurbineResources.properties for the following entries

# pick up our private modules

module.packages=com.kiasoft.appname.modules

# AND

# -------------------------------------------------------------------
#
#  S C H E D U L E R  S E R V I C E
#
# -------------------------------------------------------------------


#
# Set enabled to true to start the scheduler.
#
scheduler.enabled=true


I'm not exactly sure why this works or how scheduler knows to look for
scheduledjobs in that particular class heirarchy as it has been a while
since I wrote the scheduled service.. I just know that this is currently
working for me.

I know that there is a way to also hard code your scheduled jobs to be
picked up from the TurbineResources.properties file as well rather than
the database entry but I never experimented with that route.

Thanks,

Jeff Painter
painter@kiasoft.com




Konrad Rokicki wrote:

>What is the best place to put the code to add a job to the
>SchedulerService if I want it to run when the server starts?
>Thanks,
>Konrad Rokicki
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org