3

I have this quartz cron expression: exp = "0 * * ? * *" that runs every minute. I use this expression as a trigger to call a HTTP POST method every minute. The problem is that it calls the post method multiple times. I need an expression that will execute one time in a minute. Any suggestion how to do that?

Eraldo Forgoli
  • 65
  • 1
  • 3
  • 13

4 Answers4

13

This works with Quartz.

Every 1 minute, exactly at the start of a minute - 0 0/1 * * * ?

Anil Konduru
  • 878
  • 10
  • 18
3

How about a simple schedule trigger instead?

trigger = newTrigger()
    .withIdentity("trigger7", "group1")
    .withSchedule(simpleSchedule()
        .withIntervalInMinutes(1) )
    .build();

Source : Quartz tutorial-lesson-05 / Build a trigger that will fire now, then repeat every five minutes

Alex Ar
  • 76
  • 3
1

It may happen because request lasts longer than 1 min. You can simply annotate class implemented with Jobs with @DisallowConcurrentExecution, which disallow your job execute multiple times in exact time. You can check example .

Xavizo
  • 69
  • 1
  • 1
  • 8
-1

use this expression :

"* * * * *"
i.e 5 asteriks
try using that. use this link for reference :
https://crontab.guru/every-1-minute

dangi13
  • 1,275
  • 1
  • 8
  • 11