Java 中的事件传递库?

发布于 2024-09-07 17:27:51 字数 208 浏览 3 评论 0原文

我正在寻找一个库,它允许我通过套接字将简单的文本事件从服务器传递到客户端。简单而轻量级的东西。我可以自己写,但决定先检查一下这样的东西是否存在。这个想法是有一个应用程序生成事件(例如订单被拒绝或发生内部错误)并充当服务器。这些事件必须实时传递给所有连接的客户端。客户端只是一个弹出所述事件文本的托盘图标应用程序。一些简单的 UDP 客户端/服务器。有谁知道是否有 Java 库?

谢谢!

I'm looking for a library that will allow me to deliver simple text events from the server to the clients via sockets. Something simple and lightweight. I can write it myself, but decided to check if such thing exists first. The idea is that there's an application that generates events (such as order rejected or an internal error occurred) and acts as a server. Those events must be delivered to all connected clients in real-time. And a client is just a tray-icon app that pop ups the said event's text. Some simple UDP client/server. Does anyone know if there's a library out there for Java?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

原野 2024-09-14 17:27:51

有很多可能的解决方案,但如果您想要简单,我建议您尝试 Hazelcast

就像使用java.util.{Queue, Set, List, Map}一样简单。只需将 hazelcast.jar 添加到类路径中并开始编码即可。

There are many possible solutions, but if you want simple I suggest you try Hazelcast

It is as simple as using java.util.{Queue, Set, List, Map}. Just add the hazelcast.jar into your classpath and start coding.

时光清浅 2024-09-14 17:27:51

这可以通过 XMPP pubsub 轻松完成。您可以使用 Smack 连接到您选择的支持 pubsub 的服务器( OpenFireejabberd, ...) 因此创建事件的应用程序是发布者,客户端都是订阅者。它将需要使用第 3 方服务器(许多是开源的),但它只是用于所有客户端访问的单个库。我有使用 OpenFire 的经验,大约 15 分钟即可设置完毕。

许多人不会考虑这种轻量级,但实际上没有必要推出自己的 pubsub 解决方案。

This could be easily accomplished with XMPP pubsub. You can use Smack to connect to the server of your choice that supports pubsub (OpenFire, ejabberd, ...) so your application that creates the events is the publisher and the clients are all subscribers. It will require a 3rd party server to be used (many are open source), but it is just a single library for all client access. I have experience with OpenFire and it can be set up in about 15 minutes.

Many will not consider this light weight, but rolling your own pubsub solution is really not necessary.

白日梦 2024-09-14 17:27:51

您应该查看 JBoss Netty 和/或 Apache MINA,这两个都是构建网络协议的框架。尽管您当然可以用它们构建轻量级实现,但您是否认为它们简单是有争议的。

You should check out JBoss Netty and/or Apache MINA, which are both frameworks for building network protocols. It's debatable whether you consider them simple, although you can certainly build lightweight implementations with them.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文