Creatio development guide
PDF
This documentation is valid for Creatio version 7.12.0. We recommend using the newest version of Creatio documentation.

Quartz policies for the processing of overdue tasks

Glossary Item Box

Introduction

The Quartz has policies common to all types of triggers, and policies that are specific to a specific type of trigger. All policies used for the SimpleTrigger, CronTrigger or CalendarIntervalTrigger triggers are listed in the Table 1.

Table 1. Trigger policies

Quartz policy The MISFIRE_INSTR value The Terrasoft.Core.Scheduler.AppSchedulerMisfireInstruction value Trigger type
IgnoreMisfirePolicy -1 IgnoreMisfirePolicy for all types

IgnoreMisfirePolicy behavior description

Triggers with the IgnoreMisfirePolicy always will be fired in time. For such triggers, the Quartz will not update the next fire time (NEXT_FIRE_TIME).

The Quartz will fire all overdue tasks as priority, and then return to the initial trigger schedule. For example, the task with the Simple Trigger was planned for 10 iterations. Initial conditions:

  • START_TIME = 9:00
  • REPEAT_COUNT = 9 (first fire + 9 iterations)
  • REPEAT_INTERVAL = 0:15.

If the scheduler was disabled from 8:50 till 9:20, then after launch the Quartz will try to fire 2 overdue tasks as priority (in 9:00 and 9:15). After that the Quartz fires the 8 remaining tasks according to the schedule (at 9:30, 9:45, etc.).

SmartPolicy 0 SmartPolicy for all types

SmartPolicy behavior description

By default is used by Quartz for all types of triggers. According to the type and configuration of the trigger, the Quartz will select corresponding policy.  The selection algorithm for the Quartz version 2.3.2 is shown in the pseudo-code below.

if (TRIGGER_TYPE == 'SIMPLE') // Simple trigger.
    if (REPEAT_COUNT == 0) // Without repeats.
        MISFIRE_INSTR = 1 // SimpleTrigger.FireNow
    else if (REPEAT_COUNT == -1) // COntinious repeating.
        MISFIRE_INSTR = 4 // SimpleTrigger.RescheduleNextWithRemainingCount
    else // The number of repetitions is indicated.
        MISFIRE_INSTR = 2 // SimpleTrigger.RescheduleNowWithExistingRepeatCount
else if (TRIGGER_TYPE == 'CAL_INT') // СalendarInterval trigger.
    MISFIRE_INSTR = 1 // CalendarIntervalTrigger.FireOnceNow
else if (TRIGGER_TYPE == 'CRON') // Cron trigger.
    MISFIRE_INSTR = 1 // CronTrigger.FireOnceNow

SimpleTrigger.FireNow 1 FireNow SimpleTrigger

SimpleTrigger.FireNow behavior description

Applied for the SimpleTrigger triggers that have the REPEAT_COUNT=0 (triggers fired for one time). If the REPEAT_COUNT value is not “0”, then the SimpleTrigger.RescheduleNowWithRemainingRepeatCount policy will be applied. 

For example, the task planned with the SimpleTrigger. Initial conditions:

  • START_TIME = 9:00;
  • REPEAT_COUNT = 0.

If the scheduler was disabled from 8:50 till 9:20, then after launch the Quartz will try to fire the task as priority. As a result, the task will be fired at 9:20 or later.

SimpleTrigger.RescheduleNowWithExistingRepeatCount 2 RescheduleNowWithExistingRepeatCount SimpleTrigger

SimpleTrigger.RescheduleNowWithExistingRepeatCount behavior description

Scheduler will try to fire the first overdue task as a priority, All other triggers will be fired with the REPEAT_INTERVAL interval. 

For example, the task with the Simple Trigger was planned for 10 iterations. Initial conditions:

  • START_TIME = 9:00
  • REPEAT_COUNT = 9
  • REPEAT_INTERVAL = 0:15.

If the scheduler was disabled from 8:50 till 9:20, then after launch the Quartz will try to fire first overdue task scheduled for 9:00 (from tasks scheduled on 9:00 and 9:15) at 9:20. The remained 9 tasks will be fired at 9:35, 9:50, etc.

NOTE

For the AppScheduler.ScheduleMinutelyJob methods the behavior of the RescheduleNowWithExistingRepeatCount is similar to the RescheduleNowWithRemainingRepeatCount, and the behavior of the RescheduleNextWithRemainingCount is similar to the RescheduleNextWithExistingCount, because the triggers with the REPEAT_COUNT = -1 are used.

SimpleTrigger.RescheduleNowWithRemainingRepeatCount 3 RescheduleNowWithRemainingRepeatCount SimpleTrigger

SimpleTrigger.RescheduleNowWithRemainingRepeatCount behavior description

Scheduler will try to fire the first overdue task as a priority, Other overdue tasks are ignored. The scheduler fires remained tasks that are not overdue with the REPEAT_INTERVAL interval.

For example, the task with the Simple Trigger was planned for 10 iterations. Initial conditions:

  • START_TIME = 9:00
  • REPEAT_COUNT = 9
  • REPEAT_INTERVAL = 0:15.

If the scheduler was disabled from 8:50 till 9:20, then after launch the Quartz will try to fire first overdue task (from tasks scheduled on 9:00 and 9:15) at 9:20. The second overdue task will be ignored and other 8 tasks will be fired at 9:35, 9:50, etc.

SimpleTrigger.RescheduleNextWithRemainingCount 4 RescheduleNextWithRemainingCount SimpleTrigger

SimpleTrigger.RescheduleNextWithRemainingCount behavior description

The scheduler ignores overdue tasks and waits for the next planned fire of the task. At the next fire time, the remaining non-overdue tasks will be executed with the REPEAT_INTERVAL interval. 

For example, the task with the Simple Trigger was planned for 10 iterations. Initial conditions:

  • START_TIME = 9:00
  • REPEAT_COUNT = 9
  • REPEAT_INTERVAL = 0:15.

If the scheduler was disabled from 8:50 till 9:20, then after launch the Quartz will fire the rest of 8 non-overdue tasks at 9:30, 9:45, etc.

SimpleTrigger.RescheduleNextWithExistingCount 5 RescheduleNextWithExistingCount SimpleTrigger

SimpleTrigger.RescheduleNextWithExistingCount behavior description

The scheduler will wait for the next launch time and will fire all remained tasks with the REPEAT_INTERVAL interval.

For example, the task with the Simple Trigger was planned for 10 iterations. Initial conditions:

  • START_TIME = 9:00
  • REPEAT_COUNT = 9
  • REPEAT_INTERVAL = 0:15.

If the scheduler was disabled from 8:50 till 9:20, then after launch the Quartz will fire all 10 tasks at 9:30, 9:45, etc.

CronTrigger.FireOnceNow 1 - CronTrigger

CronTrigger.FireOnceNow behavior description

Scheduler will try to fire the first overdue task as a priority. Other overdue tasks are ignored. Remained non-overdue tasks are fired by the scheduler according to the schedule.

For example, the task planned with the CronTrigger: CRON_EXPRESSION = '0 0 9-17 ? * MON-FRI' (from Monday to Friday 9:00 AM – 17:00 PM). If the scheduler was disabled from 8:50 till 10:20, then after launch at 10:20 the Quartz will try to fire first overdue task from two (at 9:00 and 10:00). After that, tasks will be fired at 11:00, 12:00, etc.

CronTrigger.DoNothing 2 - CronTrigger

CronTrigger.DoNothing behavior description

Scheduler ignores all overdue tasks. Remained non-overdue tasks will be fired according to the schedule.

For example, the task planned with the CronTrigger: CRON_EXPRESSION = '0 0 9-17 ? * MON-FRI' (from Monday to Friday 9:00 AM – 17:00 PM). If the scheduler was disabled from 8:50 till 10:20, then after launch the Quartz will start to fire tasks since 11:00 (at 11:00, 12:00, etc).

CalendarIntervalTrigger.FireOnceNow 1 - CalendarIntervalTrigger

CalendarIntervalTrigger behavior description

The behavior is similar to the CronTrigger.FireOnceNow.

CalendarIntervalTrigger.DoNothing 2 - CalendarIntervalTrigger

CalendarIntervalTrigger.DoNothing behavior description

The behavior is similar to the CronTrigger.DoNothing

 

 

 

© bpm'online 2002-2019.

Did you find this information useful?

How can we improve it?