MotechSchedulerActionProxyService

public interface MotechSchedulerActionProxyService

Proxy registered with the task channel, exposing the scheduler service as task actions.

Methods

scheduleCronJob

void scheduleCronJob(String subject, Map<Object, Object> parameters, String cronExpression, DateTime startTime, DateTime endTime, Boolean ignorePastFiresAtStart)

Schedules job, which will be fired on every match with given cron expression.

Parameters:
  • subject – the subject for MotechEvent fired, when job is triggered, not null
  • parameters – the parameters for MotechEvent, not null
  • cronExpression – the cron expression defining when job should be triggered, not null
  • startTime – the DateTime at which should become ACTIVE, not null
  • endTime – the DateTime at which job should be stopped, null treated as never end.
  • ignorePastFiresAtStart – the flag defining whether job should ignore past fires at start or not, not null

scheduleDayOfWeekJob

void scheduleDayOfWeekJob(String subject, Map<Object, Object> parameters, DateTime start, DateTime end, List<Object> days, DateTime time, Boolean ignorePastFiresAtStart)

Schedules job, which will be fired at given time on days of week provided by user.

Parameters:
  • subject – the subject for MotechEvent fired, when job is triggered, not null
  • parameters – the parameters for MotechEvent, not null
  • start – the DateTime at which should become ACTIVE, not null
  • end – the DateTime at which job should be stopped, null treated as never end
  • days – the list of days at which job should be fired, not null
  • time – the Time at which job should be fired
  • ignorePastFiresAtStart – the flag defining whether job should ignore past fires at start or not, not null

scheduleRepeatingJob

void scheduleRepeatingJob(String subject, Map<Object, Object> parameters, DateTime startTime, DateTime endTime, Integer repeatCount, Integer repeatIntervalInSeconds, Boolean ignorePastFiresAtStart, Boolean useOriginalFireTimeAfterMisfire)

Schedules job, which will be fired every user-specified time interval(in milliseconds), but won’t be fired more than given number of times.

Parameters:
  • subject – the subject for MotechEvent fired, when job is triggered, not null
  • parameters – the parameters for MotechEvent, not null
  • startTime – the DateTime at which should become ACTIVE, not null
  • endTime – the DateTime at which job should be stopped, null treated as never end
  • repeatCount – the number of time job should be triggered, -1 treated as infinite, not null
  • repeatIntervalInSeconds – the interval(in seconds) between job fires, not null
  • ignorePastFiresAtStart – the flag defining whether job should ignore past fires at start or not, not null
  • useOriginalFireTimeAfterMisfire – the flag defining whether job should use original fire time after misfire, not null

scheduleRepeatingPeriodJob

void scheduleRepeatingPeriodJob(String subject, Map<Object, Object> parameters, DateTime startTime, DateTime endTime, Period repeatPeriod, Boolean ignorePastFiresAtStart, Boolean useOriginalFireTimeAfterMisfire)

Schedules job, which will be fired every, user-specified period.

Parameters:
  • subject – the subject for MotechEvent fired, when job is triggered, not null
  • parameters – the parameters for MotechEvent, not null
  • startTime – the DateTime at which should become ACTIVE, not null
  • endTime – the DateTime at which job should be stopped, null treated as never end
  • repeatPeriod – the Period between job fires, not null
  • ignorePastFiresAtStart – the flag defining whether job should ignore past fires at start or not, not null
  • useOriginalFireTimeAfterMisfire – the flag defining whether job should use original fire time after misfire

scheduleRunOnceJob

void scheduleRunOnceJob(String subject, Map<Object, Object> parameters, DateTime startDate)

Schedules job, which will be fired only once at date given by user.

Parameters:
  • subject – the subject for MotechEvent fired, when job is triggered, not null
  • parameters – the parameters for MotechEvent, not null
  • startDate – the DateTime at which should become ACTIVE, not null

unscheduleJobs

void unscheduleJobs(String subject)

Unschedules all jobs with given subject in their name.

Parameters:
  • subject – the subject for deleting jobs