Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to call a method after some specific interval of time in Java

Tags:

java

timer

Here is the use case:

I am using Java (with Spring)

Once the user (through a web-app) confirms to the subscription, I want to send him an email exactly after 30 mins.

Now how to do this? Do I need a message broker? or something like ScheduledExecutorService? Do I need some sort of queue?

Please advise.

like image 913
adi Avatar asked Feb 23 '23 10:02

adi


1 Answers

Can look into quartz scheduler for this.

By the way a common strategy is to send a bulk of all pending mails in bulk in every 30 minutes or so. Quartz can help in do that as well.

like image 126
Nishant Avatar answered Apr 07 '23 09:04

Nishant