2

I am designing a notification service (server). I can have two kinds of notifications: one which is delivered immediately, and the other is delivered at some time in the future.

Is there a framework to handle the future notifications?

I know I can write background worker who can for example sample the DB to look for a notification which needs to be sent, but I sure millions tried to solve this problem already and I'd prefer to reuse a proven solution.

I didn't decide yet on the framework / DB. I am thinking I should use either vertx.io or Jetty (WebSockets) for push notification. I am not sure regarding the DB because I wanted it to support those future notifications.

Update: How will you recommend I should save the data in DB for "live" notifications (notifications which exists in the users inbox) and for future notifications?

Update: I am thinking of using either:

  1. Jetty + Spring for WebSocket & SockJS + Quartz
  2. Vertx.io (Supports Websocket and Sockjs)

Any recommendation?

Shiran Maor
  • 309
  • 2
  • 5
  • 18
  • [Spring Scheduling](http://docs.spring.io/spring/docs/current/spring-framework-reference/html/scheduling.html)? – rmlan Feb 05 '16 at 17:44
  • Not sure how scalable this is. For every new notification created, I will create a job for it/ schedule a job? – Shiran Maor Feb 05 '16 at 18:28

1 Answers1

3

One approach is to deliver the notifications to a Scheduling component. The scheduling component consumes all notifications, stores it and checks regularly to see if a notification is due to be sent out.

This will allow to attach a listener to the notifications and not pile up the notifications at publisher side.

techuser soma
  • 4,766
  • 5
  • 23
  • 43
  • Thats the general idea - I agree. My question was about frameworks / solutions that are already exists out there before implementing by ourselfs – Shiran Maor Feb 05 '16 at 18:48
  • 1
    Make sure you're checking what, if anything, is scheduled each tick and not polling each job to see if it should run each time instead. If you're using Java Quartz can take this off your hands. – TheFiddlerWins Feb 05 '16 at 19:32
  • @TheFiddlerWins, +1 for Quartz – techuser soma Feb 05 '16 at 19:52
  • Thanks for your responses. Java Quartz looks good, but this is just for scheduling. Is there anything that combine the way I should store my data? I remind the it's notification, So I am curious if there is a DB framework that combine those 2, so I will not need to write "job code" to take something from db and process it when time comes) – Shiran Maor Feb 05 '16 at 22:06
  • These may provide ideas, http://stackoverflow.com/questions/17599155/sending-a-jms-message-from-oracle-database-on-dml-event, http://docs.oracle.com/cd/B19306_01/appdev.102/b14251/adfns_dcn.htm – techuser soma Feb 18 '16 at 15:15