After resuming the scheduler, it triggers automatically at that time only

Hello,

I have scheduled a campaign in the morning, that have cron expression like : 0 0 16 1,2 7 ?
Now, I paused this scheduler and manually executed this scheduler.

After some time, I want to again resume this scheduler so that it will be scheduled for tomorrow at the required time i.e. 16:00
But when I resumed this job by clicking on resume job button then it got triggered at that same time time when i clicked on resume job button.
It should not happen.
It should be again scheduled for tomorrow.
How can I resolve this issue ?
Kindly provide your suggestion on this.

Hell Suprita.

Please provide you Jmix version.

It looks like result of the misfire instruction.
When trigger is resumed Scheduler checks if it was misfired - was unable to be executed in a proper time.

By default trigger is created with ‘Smart policy’ - in case of misfired trigger it runs once immediately and then rescheduled.

Ability to set misfire instructions to trigger via Add-on UI has been added in Jmix 2.1.
To skip all misfires and just reschedule you need ‘Do nothing’ misfire instruction.

But in older versions trigger is always created with the default value - ‘Smart policy’.
In these version you can configure misfire instruction only if you create job manually via Quartz API:

  • Build JobDetails and Trigger via JobBuilder\TriggerBuilder and add them to Scheduler bean. But all of this should be performed within custom code.
  • Or create design-time job as beans
    For example:
@Bean("project_YourCustomJob")
JobDetail yourCustomJob() {
    return JobBuilder.newJob()
            .ofType(YourJobClass.class)
            .storeDurably()
            .withIdentity("UniqueJobName")
            .build();
}

@Bean("project_YourCustomJobTrigger")
Trigger yourCustomJobTrigger(@Qualifier("project_YourCustomJob") JobDetail yourCustomJob) {
    return TriggerBuilder.newTrigger()
            .withIdentity("UniqueTriggerName")
            .forJob(yourCustomJob)
            .startNow()
            .withSchedule(
                    CronScheduleBuilder
                            .cronSchedule("<your cron expression>")
                            .withMisfireHandlingInstructionDoNothing()
            ).build();
}

Regards,
Ivan