我应该使用带有websockets的此webapp使用什么解决方案。 ActiveMQ? [英] What solution should I use for this webapp with websockets. ActiveMQ?

查看:79
本文介绍了我应该使用带有websockets的此webapp使用什么解决方案。 ActiveMQ?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发一个Web应用程序,该应用程序需要一个websocket连接来接收来自服务器的事件通知。

I'm currently in the middle of developing a webapplication which needs a websocket connection to receive notifications of events from the server.

客户端分为几组,组中的所有客户端都必须接收相同的事件通知。

The clients are separated in groups and all the clients in a group must receive the same event notifications.

我认为ActiveMQ可能支持此模型,并为每个客户端组使用不同的队列。使用stomp将事件推送到ActiveMQ,然后为客户端使用stomp-over-websockets也相对容易。

I thought that ActiveMQ could probably support this model, using different queues for each group of clients. It would also be relatively easy to push events to ActiveMQ using stomp, and then use stomp-over-websockets for the clients.

我看到的问题是消息不应该只能由一个客户端使用,但分发给连接到队列的所有客户端。

The problem I see is that messages should not be consumed by only one client, but distributed to all the clients connected to the queue.

也不应存储队列。如果生成事件时客户端未连接,则它将永远不会收到它。

Also the queue should not be stored. If a client is not connected when the event is generated, then it will never receive it.

我不太了解ActiveMQ,所以我不确定是否这是有可能的,或者如果可以使用另一种简单的解决方案代替编写自己的消息服务器。

I don't know ActiveMQ that much, so I'm not sure if this is possible or if there is another easy solution that could be used instead of writing my own message server.

谢谢

推荐答案

ActiveMQ 5.4.1本机支持WebSocket(就像Stomp,JMS等一样)。
有队列的概念(您提到过这些),但也有主题。

ActiveMQ 5.4.1 supports WebSockets natively (just like Stomp, JMS, etc.). There is the concept of queues (you mentioned these), but also of topics.

在队列中,只有一个消费者会收到一条消息,在主题
中,它到达所有订户。请参阅: http://activemq.apache.org /how-does-a-queue-compare-to-a-topic.html

In a queue, a single message will be received by exactly one consumer, in a topic it goes to all the subscribers. See: http://activemq.apache.org/how-does-a-queue-compare-to-a-topic.html

周围有一些Stomp-WebSocket JS库。 Kaazing有一个包含ActiveMQ的软件包,并通过WebSockets支持JMS API / Stomp协议,并支持较旧的浏览器,不同的客户端技术和跨站点安全性。

There are some Stomp-WebSocket JS libraries floating around. Kaazing has a bundle that includes ActiveMQ and supports JMS API/Stomp protocol over WebSockets with support for older browsers, different client technologies, and Cross-Site security.

这篇关于我应该使用带有websockets的此webapp使用什么解决方案。 ActiveMQ?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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