-1

I'm building an auction site in Spring and Postgres where the user can list his product and other user can bid and buy (like ebay).

What I want to do is when some auction ends the system send and email to the user saying to check the page and pay. These dates are stored in the auction table and can be any date (the end date is the starting date + 30 days).

Someone knows how can I send an email on this dates (the best way to do without overload the system!)?

thanks

BalusC
  • 992,635
  • 352
  • 3,478
  • 3,452
amachado
  • 992
  • 1
  • 13
  • 28
  • You should checkout spring scheduler (http://docs.spring.io/spring/docs/current/spring-framework-reference/html/scheduling.html) and spring email (http://docs.spring.io/spring/docs/current/spring-framework-reference/html/mail.html) – olahell Jan 14 '16 at 13:00

2 Answers2

0

You can execute some job on some interval, lets say every day. In this job you query the table from the database and chek if you have to send mails for some auction.

Evgeni Dimitrov
  • 19,437
  • 29
  • 105
  • 137
  • I want to send the email right after the auction ends so or I run the job every minute or I need to do something else! – amachado Jan 14 '16 at 21:03
0

I don't know if is the most correct way, but I follow https://stackoverflow.com/a/18896316/3237975 and everything worked as I wanted.

I just change a little bit the class CustomTask to accept an input date and done!!

Thanks for the help

(if this approach is not the best performance wise, please advice other better)

Community
  • 1
  • 1
amachado
  • 992
  • 1
  • 13
  • 28