Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reminder push notification using Spring Boot and Angular

I need to build a web application using Spring Boot for the RESTful API and Angular (4 or 5) which will remind the user at the right time. For e.g. if I have a meeting at 11 AM, my server component should know that there is this meeting at 11 AM real-time and then push the notification through WebSockets. I could not find any useful resources on the web which can help me understand and design this specific component which needs to listen for a database event every second.

Can anyone please help me out here in architecting this single component with the right choice of tools? Should this be a queue like Apache Kafka or Apache Storm, or something else entirely?

like image 639
Samir Joglekar Avatar asked Apr 05 '18 12:04

Samir Joglekar


1 Answers

This is web application, so events will be delivered only if user is logged in, right? In that case it is likely that most events would not be delivered because there is no user.

I would deliver events using Websocket see Spring guide how to do that https://spring.io/guides/gs/messaging-stomp-websocket/

Simple solution would schedule all events using tool like http://www.quartz-scheduler.org/. Then if event fires and user is logged in then event notification will be send using websocket. But that may be wasteful if you have large number of users.

More lightweight solution would be

  • when user logs in, check if he has scheduled events. Then register notifications for them at client side, using client-side javascript scheduling.
  • when there is server-side change for event for user, you need to deliver updates about those events to logged in users.

For me message queues doe not apply there. When you queue message for future event there is no sensible way for this message to be consumed when the event is about to occur.

like image 102
Bartosz Bilicki Avatar answered Nov 14 '22 23:11

Bartosz Bilicki