Class BTImmediateSchedulingScheduler
java.lang.Object
overit.geocall.bl.BusinessTask<Void>
overit.geocallapp.wfm.scheduling.bl.immediatescheduling.processing.task.BTImmediateSchedulingScheduler
- All Implemented Interfaces:
Serializable,Tool
Business task to schedule immediate scheduling processes based on calendar configuration.
This task checks the immediate scheduling calendar and creates new processing records when the configured interval has elapsed since the last processing.
This task checks the immediate scheduling calendar and creates new processing records when the configured interval has elapsed since the last processing.
The task runs periodically and:
- Retrieves all active calendar entries
- For each entry, checks if there are any processing records in progress or waiting
- If not, retrieves the tracking record to check when the last immediate scheduling ended
- If enough time has elapsed since the last execution, enqueues a new processing record via
ImmediateSchedulingEnqueueEvent
The task uses the BOImmediateSchedulingTracking table to efficiently track the last execution dates
instead of searching through the history table.
This task should be scheduled to run periodically (e.g., every 1-2 minutes).
- Since:
- 22.0
- See Also:
- GCApi:
- task
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidImplements this method to write the specific task logic to handle the input parameter.protected BOImmediateSchedulingTrackinggetTrackingRecord(Long operationCenter, Long schedulingModel, PoolKit poolKit) Get the tracking record for the given operation center and scheduling modelprotected booleanhasProcessingInProgressOrWaiting(Long operationCenter, Long schedulingModel, PoolKit poolKit) Check if there are any processing records in progress or waiting for the given operation center and scheduling modelprotected voidprocessCalendarEntry(BOImmediateSchedulingCalendar calendar, Date now, PoolKit poolKit) Process a single calendar entry to determine if a new processing should be scheduled.protected voidscheduleNewProcessing(Long operationCenter, Long schedulingModel, boolean reprocessing, boolean autoValidationEnabled, PoolKit poolKit) Schedule a new processing by launching theImmediateSchedulingEnqueueEvent.protected booleanshouldScheduleProcessing(Long intervalMinutes, Date lastProcessingEndDate, Date now) Determine if a new processing should be scheduled based on the interval and last execution date.Methods inherited from class overit.geocall.bl.BusinessTask
start, start, startAlone, startInBackground
-
Constructor Details
-
BTImmediateSchedulingScheduler
public BTImmediateSchedulingScheduler()
-
-
Method Details
-
body
Description copied from class:BusinessTaskImplements this method to write the specific task logic to handle the input parameter.- Specified by:
bodyin classBusinessTask<Void>- Parameters:
input- the object upon which the task will works onpoolKit- the poolkit containing the reference to the database connection that can be used- Throws:
DAException- in case of database errorDAValidateException- in case of database validation error
-
processCalendarEntry
protected void processCalendarEntry(BOImmediateSchedulingCalendar calendar, Date now, PoolKit poolKit) throws DAException, DAValidateException Process a single calendar entry to determine if a new processing should be scheduled.This method:
- Checks if there are any processing records in progress or waiting
- Retrieves the tracking record to get the last immediate and reprocessing execution dates
- Determines if enough time has elapsed for immediate scheduling or reprocessing
- Schedules a new processing if needed
- Parameters:
calendar- the calendar entrynow- the current date/timepoolKit- the pool kit- Throws:
DAException- if a database error occursDAValidateException- if validation fails
-
hasProcessingInProgressOrWaiting
protected boolean hasProcessingInProgressOrWaiting(Long operationCenter, Long schedulingModel, PoolKit poolKit) throws DAException, DAValidateException Check if there are any processing records in progress or waiting for the given operation center and scheduling model- Parameters:
operationCenter- the operation center IDschedulingModel- the scheduling model IDpoolKit- the pool kit- Returns:
- true if there are processing records in progress or waiting
- Throws:
DAException- if a database error occursDAValidateException- if validation fails
-
getTrackingRecord
protected BOImmediateSchedulingTracking getTrackingRecord(Long operationCenter, Long schedulingModel, PoolKit poolKit) throws DAException, DAValidateException Get the tracking record for the given operation center and scheduling model- Parameters:
operationCenter- the operation center IDschedulingModel- the scheduling model IDpoolKit- the pool kit- Returns:
- the tracking record, or null if none found
- Throws:
DAException- if a database error occursDAValidateException- if validation fails
-
shouldScheduleProcessing
protected boolean shouldScheduleProcessing(Long intervalMinutes, Date lastProcessingEndDate, Date now) Determine if a new processing should be scheduled based on the interval and last execution date.A new processing should be scheduled if:
- The interval is configured (not null and greater than 0)
- The last processing end date is before the threshold date (now - interval)
- Parameters:
intervalMinutes- the interval in minutes (immediate or reprocessing)lastProcessingEndDate- the end date of the last processing (null if no last processing)now- the current date/time- Returns:
- true if a new processing should be scheduled
-
scheduleNewProcessing
protected void scheduleNewProcessing(Long operationCenter, Long schedulingModel, boolean reprocessing, boolean autoValidationEnabled, PoolKit poolKit) throws DAException, DAValidateException Schedule a new processing by launching theImmediateSchedulingEnqueueEvent.This method delegates to the
BTImmediateSchedulingEnqueuetask which will:- Search for an existing last processing record
- Update it or create a new one with state TO_BE_PROCESSED
- Create a history record
- Parameters:
operationCenter- the operation center IDschedulingModel- the scheduling model IDreprocessing- true if this is a reprocessing, false for immediate schedulingautoValidationEnabled- true if auto validation is enabledpoolKit- the pool kit- Throws:
DAException- if a database error occursDAValidateException- if validation fails
-