Interface RuleScheduleStore

All Known Implementing Classes:
JiraRuleScheduleStore

public interface RuleScheduleStore
CRUD operations around schedules for rules.
  • Method Details

    • getScheduledRulesAndAdvanceSchedule

      List<RuleSchedule> getScheduledRulesAndAdvanceSchedule(Environment env, Instant now)
      Retrieves all rule schedules where their next execution time is before the passed in 'now' date. Basically this returns all overdue schedules that need to run.

      Implementations should retrieve all overdue scheduled rules and update their schedules to the next scheduled date as an atomic store operation. This is to ensure a scheduled rule will only be executed once at it's scheduled time.

      Parameters:
      env - The environment
      now - Current time
      Returns:
      List of rules to execute. May be empty
    • setSchedule

      void setSchedule(TenantContext context, RuleSchedule newSchedule)
    • removeSchedule

      void removeSchedule(TenantContext context, RuleSchedule schedule)
    • recordErrorOrRemove

      boolean recordErrorOrRemove(TenantContext context, long scheduleId)
      increases error count for a rule schedule. If we exceed 3 errors, the schedule is removed and this method returns true
      Returns:
      true if the rule schedule was removed
    • clearErrorCount

      void clearErrorCount(TenantContext context, long scheduleId)