java 需要通知/仪表板系统的框架吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16861026/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Need a framework for a notification/dashboard system?
提问by Shawn D.
I've been asked to implement a notification system in a Cloud Java application. The premise is that administrators or components of the application can send either specific messages to individual users, or broadcast announcements to all users.
我被要求在 Cloud Java 应用程序中实现一个通知系统。前提是管理员或应用程序的组件可以向单个用户发送特定消息,或向所有用户广播公告。
Notifications would be categorized by severity, type (outages, new services, etc.), and corresponding component.
通知将按严重性、类型(中断、新服务等)和相应的组件进行分类。
Users would be able to select types and components they're interested in, and how they'd like to receive those notifications (by e-mail, just shown on dashboard, SMS, etc.). Users could acknowledge or delete notifications, so they won't show up for that user anymore.
用户将能够选择他们感兴趣的类型和组件,以及他们希望如何接收这些通知(通过电子邮件,仅显示在仪表板、SMS 等上)。用户可以确认或删除通知,因此它们将不再显示给该用户。
Although I'm sure this would be interesting to implement from scratch, it just feels like there should be an existing system, Apache project, commercial project, etc. that does just this and would avoid me having to reinvent the wheel.
虽然我确信从头开始实施这会很有趣,但感觉应该有一个现有的系统、Apache 项目、商业项目等来做到这一点,这样我就不必重新发明轮子了。
My question is:Can anyone recommend a framework for notification tracking that could be integrated into an existing application and automatically handle all the back end stuff? Commercial or open source are fine, as long as the licensing terms are commercial friendly (no GPL or LGPL, please).
我的问题是:谁能推荐一个可以集成到现有应用程序中并自动处理所有后端内容的通知跟踪框架?商业或开源都可以,只要许可条款对商业友好(请不要使用 GPL 或 LGPL)。
回答by Subhas
I guess what you are looking for is something similar to Amazon Simple Notification Service (SNS). But first let's set some things straight:
我猜您正在寻找类似于Amazon Simple Notification Service (SNS) 的东西。但首先让我们明确一些事情:
- You're trying to send Email/SMS - and both require Infrastructure, not just frameworks/libraries. I guess your client (or anyclient for that matter) would have an Email server running somewhere, so you won't have a direct cost impact. But sending SMS doesincur an infrastructure overhead.
- You won't have an out-of-the-box solution. Since you'll be having additional infrastructure, you will end up at least writing a good level of integration with this infrastructure.
- 您正在尝试发送电子邮件/短信 - 两者都需要Infrastructure,而不仅仅是框架/库。我猜您的客户端(或任何与此相关的客户端)会在某处运行电子邮件服务器,因此您不会对成本产生直接影响。但是发送 SMS确实会产生基础设施开销。
- 您将没有开箱即用的解决方案。由于您将拥有额外的基础架构,因此您最终至少会编写与此基础架构的良好集成。
Keeping all that in mind, here are the options, listed in order of difficulty:
牢记所有这些,以下是按难度顺序列出的选项:
- Use Amazon SNS
- Use Cloud Message Bus (CMB)- an open-source clone of Amazon SNS. It has the same API format as Amazon SNS, so you'll use this the same way you use Amazon SNS
- Use Apache Camelwith its various Email/SMS Components. Apache Camel is an enterprise routing framework. It has a Message Queue where developers can push messages into, and then it has various routers which take these messages and send them elsewhere. It has routers for sending Email/SMSout-of-the-box. You would first create a topic to which you post messages. Then when a user registers for email notifications, you would add an email endpointfor him/her. And when they opt-out of Email, you will remove that endpoint. Basically its very close to designing your own solution - except you don't have to write code for sending SMS/Email, it has out-of-the-box components for doing that, and you just have to write integration code to add those endpoints as and when the user subscribes for notifications.
- Roll your own. Your solution would end up being very similar to the Apache Camel approach. You will have a message queue, you will have topics and listeners. Except you'll be writing your own code to send all the emails/SMS.
- 使用亚马逊 SNS
- 使用云消息总线 (CMB)- Amazon SNS 的开源克隆。它具有与 Amazon SNS 相同的 API 格式,因此您将像使用 Amazon SNS 一样使用它
- 使用Apache Camel及其各种电子邮件/短信组件。Apache Camel 是一个企业路由框架。它有一个消息队列,开发人员可以将消息推送到其中,然后它有各种路由器,可以接收这些消息并将它们发送到其他地方。它具有用于发送电子邮件/短信开箱即用的路由器。您将首先创建一个主题,您可以向其发布消息。然后当用户注册电子邮件通知时,您将添加一个电子邮件端点为他/她。当他们选择退出电子邮件时,您将删除该端点。基本上它非常接近于设计您自己的解决方案 - 除了您不必编写用于发送 SMS/电子邮件的代码,它具有用于执行此操作的开箱即用组件,您只需要编写集成代码来添加这些用户订阅通知时的端点。
- 自己卷。您的解决方案最终将与 Apache Camel 方法非常相似。您将拥有一个消息队列,您将拥有主题和侦听器。除了您将编写自己的代码来发送所有电子邮件/短信。
Edit: Minor clarifications
编辑:小说明
回答by Roy Kachouh
It looks like your requirement is some sort of live data in a browser based web application. If that is correct, there have been great strides in some of the HTML 5 apis, specifically web sockets.
看起来您的要求是基于浏览器的 Web 应用程序中的某种实时数据。如果这是正确的,那么在某些 HTML 5 apis,特别是 web sockets 中已经有了很大的进步。
Websockets are an extension of the HTTP protocol that allow for bi channel communication between client and server. There is a downside however. Believe it or not, browser support is still pretty scarce, and some complications arise with http proxies in the wild.
Websockets 是 HTTP 协议的扩展,允许客户端和服务器之间的双通道通信。然而,有一个缺点。信不信由你,浏览器支持仍然非常稀缺,并且在野外使用 http 代理会出现一些复杂情况。
Typically, to circumvent the lack of widely accepted support, there have been quite a few javascript/server side frameworks that have surfaced that seem really promising. These frameworks typcially take care of fallback support when websockets aren't supported. Some fall back technologies include server sent events, jsonp, long polling, short polling etc.
通常,为了避免缺乏广泛接受的支持,已经出现了很多看起来非常有前途的 javascript/服务器端框架。当不支持 websockets 时,这些框架通常会处理回退支持。一些回退技术包括服务器发送事件、jsonp、长轮询、短轮询等。
2 excellent open source projects come to mind:
我想到了 2 个优秀的开源项目:
1). Atmoshphere: https://github.com/Atmosphere/atmosphere
1)。大气层:https: //github.com/Atmosphere/atmosphere
2). Socket-io - http://socket.io/
2)。套接字-io - http://socket.io/