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?
Quartz Expression that runs every minute only once
This works with Quartz.
Every 1 minute, exactly at the start of a minute - 0 0/1 * * * ?
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
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 .
use this expression :
"* * * * *"
i.e 5 asteriks
try using that.
use this link for reference :
https://crontab.guru/every-1-minute
It doesen't work. The expression is not valid. The expression should be a quartz one. –
Catty
© 2022 - 2024 — McMap. All rights reserved.