Modules‎ > ‎Plugin‎ > ‎

Plugin -> Task Scheduler

Plug-in -> Task Scheduler


This is a new powerful feature introduced to the Wavelet Enterprise Management system beginning from version 1.7. This module allows the user to configure automated tasks such as sending e-mail notifications. This feature greatly assist higher management who are too busy and yet, wants to be alerted with business critical updates such as:
  • When the inventory level hits a specified minimum quantity,
  • when the invoices are due,
  • when a certain estimated delivery date to the customer has lapsed, and etc

The Wavelet EMP's plug-in module basically comprises of 2 main area, the scheduler, and the tasks.

Plug-in scheduler

This feature allows the user to configure the scheduler to be turned on or off. This can be done under:
By clicking on the check-box "Yes" and confirming it by clicking "submit", the scheduler will automatically run each time the application starts.

After activating the scheduler, the user will then have the option to either start the scheduler or leave it on stand-by mode. This can be configured under:
If this is the first time a user has ever configured this, by default, it should be "In Standby Mode". To start it, click "Start" and the status should automatically be switched to "Started".

The job/ task

Now that the scheduler has been activated, the user will need to specify on which tasks to perform automatically. The 2 key crucial settings in configuring the tasks can be summarized as below:
  • What needs to be done?
  • When should this be carried out? (Configurable by Cron scripts)
Understanding Cron scripts (You may refer this again later when you have reached the sub topic of "Creating a task" below)
The plug-in module uses cron scripts to allow user to specify when the job/ task needs to be executed. If the user did not specify anything at all, the cron script without values (seven asterisks) will be shown as below:
* * * * * * *

The meaning of each 7 asterisks are illustrated as below:
 1st *
 Second 0 through 59
 2nd *
 Minute 0 through 59
 3rd *
 Hour 0 through 23
 4th *
 Day_of_Month 1 through 31
 5th *
 Month 1 through 12
 6th *
 Day_of_week 0 through 6 (i.e. from Sunday to Saturday)
 7th *
 Year (Optional Field)
Table 1.1: Cron script accepted values

The user must specify a value for each field. Except for the year field, these fields can contain the following:
  • A number in the specified range. To run a command in May, specify 5 in the month field.
  • Two numbers separated by a dash to indicate an inclusive range. To run a cron job on Tuesday through Friday, place 2-5 in the weekday field.
  • A list of numbers separated by commas. To run a command on the first and last day of January, you would specify 1,31 in the day_of_month field.
  • A combination of two numbers separated by a dash to indicate an inclusive range and a list of numbers separated by commas can be used in conjunction. To run a command on the first, tenth to sixteenth and last day of January, you would specify 1,10-16,31 in the day_of_month field. The above two points can also be used in combination.
  • An * (asterisk), meaning all allowed values. To run a job every hour, specify an asterisk in the hour field.
Note: Any character preceded by a backslash (including the %) causes that character to be treated literally. The specification of days may be made by two fields (day of the month and day of the week). If you specify both as a list of elements, both are adhered to. For example, the following entry:
0 0 1,15 * 1 ?

would run command on the first and fifteenth days of each month, as well as every Monday. To specify days by only one field, the other field should contain an * .

See: Tutorial.html

Certain tasks are already in the Job files, and the Job Files are available here for download.

To upload the job files into your Wavelet EMP system, the user will need to perform the below procedures:
1) Download the job/ task files here
3) Select the target folder as "/files" and add the downloaded file/s individually (if more than 1 job/ task) is required to be uploaded.
4) Describe each job/ file accordingly under "File Description" and select Document Type to be "task_scheduler_job" for each job/ task that needs to be uploaded.
5) Click "Upload File"

Creating a task (With examples)

To create a task for your Wavelet EMP system, the user will need to perform the below procedures:
2) Specify accordingly, with reference to the task, the "Group", "Name" and "Description" of the task
    Group            : Billing
    Name             : Outstanding Invoice
    Description    : Email notification when there is any outstanding invoice

3) Select the required job to be executed from the drop-down list under "Job". **Note that only uploaded job/ task will be shown
    Select             : plugin-wavelet-tasksched-invOutstandingDue

4) Key in the path for the selected job/ task in the "Main Job Class"
4.1) To identify the path for the selected job/ task, extract the initially saved file/s using programs such as winrar. 2 files should be extracted out, namely "META-INF" and "Taskscheduler"
4.2) Copy and paste the entire path from "Taskscheduler" into the "Main Job Class".
        For example, if the user have downloaded the job/ task of plugin-wavelet-tasksched-invOutstandingDue.jar,
        The user should be able to drill down from Taskscheduler > Notification > Invoice_due > src > InvOutstandingDueNotification.class
        The path should appear as taskscheduler\notification\invoice_due\src\InvOutstandingDueNotification.class
4.3) After performing the copy and paste, replace the "\" with "." and remove the ".class"
        From the above example, the path that should appear in this job/ task under the "Main Job Class" should be as below:
5) Specify accordingly, with reference to the task, the "Group" and "Name" under "Trigger"
    Trigger Group            : Email notification
    Trigger Name             : Invoice triggered

    Cron Script Trigger    : Refer to the Table 1.1

    Example for Cron Script Trigger:

CronTrigger Example 1 - an expression to create a trigger that simply fires every 5 minutes

"0 0/5 * * * ?"

CronTrigger Example 2 - an expression to create a trigger that fires every 5 minutes, at 10 seconds after the minute (i.e. 10:00:10 am, 10:05:10 am, etc.).

"10 0/5 * * * ?"

CronTrigger Example 3 - an expression to create a trigger that fires at 10:30, 11:30, 12:30, and 13:30, on every Wednesday and Friday.

"0 30 10-13 ? * WED,FRI"

CronTrigger Example 4 - an expression to create a trigger that fires every half hour between the hours of 8 am and 10 am on the 5th and 20th of every month. Note that the trigger will NOT fire at 10:00 am, just at 8:00, 8:30, 9:00 and 9:30

"0 0/30 8-9 5,20 * ?"

6) Click "Create task" to confirm the settings and create the task
7) Load the created task into the scheduler by clicking "(Re)Load Task to scheduler now"

List Task

To view created tasks, the user may goto:

Edit Task

From the tasks listing in PLUGIN > LIST TASK, the user may edit the created task by:
Clicking on the shortcut key "Edit" on the far right of each created task
Goto PLUGIN > EDIT TASK > KEY IN THE TASK'S PKID (which can be found in LIST TASK)
**Note to always SAVE the editted task AND CLICK RELOAD TASK TO SCHEDULER NOW