How to create CRON as a repeating event or how to use Cluster.scheduleRepeatingEvent.

How to create CRON as a repeating event or how to use Cluster.scheduleRepeatingEvent.

book

Article ID: KB0085273

calendar_today

Updated On:

Products Versions
TIBCO BusinessEvents Enterprise Edition -
Not Applicable -

Description

Description:

This function is new to TIBCO BusinessEvents(BE) 5.1.3 and is available as part of BE Studio tip help but is not present in the on-line

Documentaiton for BE 5.1.3

Function: Cluster.scheduleRepeatingEvent
Signature: void scheduleRepeatingEvent(String schedulerName, String workKey, SimpleEvent event, DateTime startingDate, long interval)
Synopsis: Schedules a simple event to be sent to the default destination beginning on startingDate, and repeating every interval.It is recommended to specify the starting date/time using DateTime.createTime()

Example: DateTime.createTime(2014, 0, 1, 0, 0, 0, null).
Parameters:
Name - Type - Description
schedulerName - String - A unique id.
workKey - String - A unique key that identifies the work item.
event - SimpleEvent - The simple event to be scheduled.
startingDate - DateTime - The starting date/time of the repeating scheduled event (date/time will be rolled into future, if defined in the past).
interval - long - The repeat interval of the scheduled event (if 0, event will be scheduled once for the exact date/time specified).
Returns: void


Symptoms:
N/A
Cause:
N/A

Issue/Introduction

How to create CRON as a repeating event or how to use Cluster.scheduleRepeatingEvent.

Resolution

Example:

Example: Schedule an event to be generated once a week on Friday at 6pm (local time).

Cluster.createScheduler("MaintenanceTasks", 60000, 60000); // Default 1 minute resolution

DateTime sch_start = DateTime.createTime(2014, 3, 4, 18, 0, 0, "UTC"); // 2014 April 4th 18:00 is a Friday
long sch_repeat = 7L * 24L * 60 * 60L * 1000L; // Repeat every 7 days
Cluster.removeSchedule("MaintenanceTasks", "Trigger@Friday18:00");

Cluster.scheduleRepeatingEvent("MaintenanceTasks", "Trigger@Friday18:00", Events.Maintenance.Maintenance(null, null, "DataCleanup"), sch_start, sch_repeat);"