REQUIREMENT contrib.scheduler |
Type | NEW |
Priority | HIGH |
Status | CLOSED |
Topic | You can receive messages published by the filewatcher and store them at a certain location on the filesystem. | ||||||||||||||||
Des cription |
If you have requirements to execute some operations or to allow some operations only during some hours of the day, or some days of a month or a week, then this plugin can do it. It is a scheduler using quartz as the underlying library. The syntax to define the execution of jobs is defined/configured in a cron- and crontab alike manner. A typical usage example would be to timely control the dispatch of messages, for example to allow messages for some clients to be dispatched only during non-rush hours (for example during the night or over the weekend). This is for instance accomplished by the org.xmlBlaster.contrib.scheduler.jobs.ReplScheduler
In the org.xmlBlaster.contrib.scheduler.jobs directory you find the provided implemented jobs. These
classes all implement the Job
interface defined by quartz. To use this plugin you need to activate it in the xmlBlasterPlugins.xml file and configure it appropriately. In the configuration of this plugin you can define attributes. All attributes starting with the prefix scheduler. will be considered jobs to be scheduled. So for example scheduler.action1 would result in a job having the assigned name action1. Note that the name of these jobs must be unique inside the plugin. 02 * * * * org.xmlBlaster.contrib.scheduler.jobs.ReplScheduler stopDispatcher | | * * * * * command to be executed further attributes: - - - - - could be more than 0 and | | | | | are depending on the job | | | | +----- day of week (0 - 6) (Sunday=0) implementation | | | +------- month (1 - 12) | | +--------- day of month (1 - 31) | +----------- hour (0 - 23) +------------- min (0 - 59)For the day of the week one can also use MON (or monday), TUE, WED, THU, FRI, SAT, SUN, this way it is easier to read the configuration. The same as for the week days is true for the month: these can also be expressed as names or as JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC. The above example would mean the ReplScheduler will stop the dispatcher for all involved replications at minute 02 every hour. For further details on the usage please look at the examples and configuration section. |
||||||||||||||||
Example any |
Scheduler Jobs for Replication By means of the scheduler you can control the dispatcher of the replication clients, i.e. you can determine when to set the callback dispatcher to active or inactive. In the cron-like command line you specify in the 6th attribute the class name of the job (ReplScheduler) and thereafter all the attributes which org.xmlBlaster.contrib.scheduler.jobs.ReplScheduler understands. These are:
00 07 * * * org.xmlBlaster.contrib.scheduler.jobs.ReplScheduler stopDispatcher 00 18 * * * org.xmlBlaster.contrib.scheduler.jobs.ReplScheduler startDispatcher 02 07 * * 6 org.xmlBlaster.contrib.scheduler.jobs.ReplScheduler startDispatcher 02 07 * * 5 org.xmlBlaster.contrib.scheduler.jobs.ReplScheduler startDispatcher This would mean that every morning at 07:00 the dispatcher is stopped, it is started again every evening at 18:00. During the weekends we want the dispatcher to be active, so the third raw means that 2 minutes after 07:00 on saturday morning and in fourth raw the same on sunday morning, the dispatcher is set to active. This would mean the dispatcher remains closed during working hour. You could also express the same of above as: 00 07 * * * org.xmlBlaster.contrib.scheduler.jobs.ReplScheduler stopDispatcher 00 18 * * * org.xmlBlaster.contrib.scheduler.jobs.ReplScheduler startDispatcher 02 07 * * saturday org.xmlBlaster.contrib.scheduler.jobs.ReplScheduler startDispatcher 02 07 * * sunday org.xmlBlaster.contrib.scheduler.jobs.ReplScheduler startDispatcheror 00 07 * * * org.xmlBlaster.contrib.scheduler.jobs.ReplScheduler stopDispatcher 00 18 * * * org.xmlBlaster.contrib.scheduler.jobs.ReplScheduler startDispatcher 02 07 * * SAT org.xmlBlaster.contrib.scheduler.jobs.ReplScheduler startDispatcher 02 07 * * SUN org.xmlBlaster.contrib.scheduler.jobs.ReplScheduler startDispatcherwhich are easier to understand than the numeric representation of above. |
||||||||||||||||
Configure |
<xmlBlaster> ... <plugin id='SchedulerPlugin' className='org.xmlBlaster.contrib.scheduler.SchedulerPlugin'> <attribute id="scheduler.closeWork">00 07 * * * org.xmlBlaster.contrib.scheduler.jobs.ReplScheduler stopDispatcher</attribute> <attribute id="scheduler.openNight">00 18 * * * org.xmlBlaster.contrib.scheduler.jobs.ReplScheduler startDispatcher</attribute> <attribute id="scheduler.openSat">02 07 * * 6 org.xmlBlaster.contrib.scheduler.jobs.ReplScheduler startDispatcher</attribute> <attribute id="scheduler.openSun">02 07 * * 0 org.xmlBlaster.contrib.scheduler.jobs.ReplScheduler startDispatcher</attribute> <action do='LOAD' onStartupRunlevel='9' sequence='10' onFail='resource.configuration.pluginFailed'/> <action do='STOP' onShutdownRunlevel='8' sequence='1'/> </plugin> ... </xmlBlaster>
The example above can also be seen on the jmx page:
NOTE: Configuration parameters are specified on command line (-someValue 17) or in the
xmlBlaster.properties file (someValue=17). See requirement "util.property" for details. |
||||||||||||||||
See REQ | engine.runlevel |
This page is generated from the requirement XML file xmlBlaster/doc/requirements/contrib.scheduler.xml