Reputation: 3647
Bidding sites like quibids and ebay has a countdown showing how much time left for the auction. I know this can be taken care on FE and should be fairly easy. What I want to know is how to do this on server side? like sending an email to people participate but didn't win and updating database when times up. I've thought about two approaches to do this.
Both approaches don't sound right to me and will lead to issues I think. Like user will likely not getting the updates on time, or server will have lots of sleeping beauty waiting.
Upvotes: 0
Views: 1744
Reputation: 2027
What I want to know is how to do this on server side? like sending an email to people participate but didn't win and updating database when times up.
The best way may vary depending of technology stack of your server side.
You if are running from a Servlet container (e.g.: Tomcat, Jboss...), you probably want to do something similar to this: Background timer task in JSP/Servlet web application
If you are running a Spring application (e.g.: Spring Boot or Spring MVC), then I recommend @Scheduled
or other Task Execution and Scheduling
For advanced scenarios you may want to go with Quartz
Something else, then you should try hooking it up with Java Timer Task
Upvotes: 1