简体   繁体   中英

How to trigger Messages at specific times?

We have a DB table where every row has a text message and a timestamp. Eg

Mesg1 09:00

Mesg2 09:01

Mesg3 09:15

Mesg4 09:20

The timings are not at a fixed interval. It is uneven. We would like to read the table as a Source and send the Messages to a Target at the configured timestamps. Components like Quartz do not allow configuring uneven trigger times.

Is there a common pattern that can be followed for such a use case?

Regards, Yash

Use camel cron component for the trigger events.

from("cron:tab?schedule=0/1+*+*+*+*+?")
.setBody().constant("event")
.log("${body}");

The schedule expression 0/3+10+ + +*+? can be also written as 0/3 10 * * *? and triggers an event every three seconds only in the tenth minute of each hour.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM