基于时间的通知架构 [英] TIme-based Notification Architecture

查看:21
本文介绍了基于时间的通知架构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设计一个通知服务(服务器).我可以有两种通知:一种是立即发送,另一种是在未来某个时间发送.

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.

我还没有决定框架/数据库.我想我应该使用 vertx.io 或 Jetty (WebSockets) 来推送通知.我不确定数据库,因为我希望它支持那些未来的通知.

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.

更新:您将如何建议我将数据保存在 DB 中以用于实时"通知(存在于用户收件箱中的通知)和将来的通知?

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?

更新:我正在考虑使用:

  1. Jetty + Spring for WebSocket &SockJS + Quartz
  2. Vertx.io(支持 Websocket 和 Sockjs)

有什么推荐的吗?

推荐答案

一种方法是将通知传送到调度组件.调度组件消耗所有通知,将其存储并定期检查以查看通知是否应发送.

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.

这篇关于基于时间的通知架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆