如何找出JMS主题的所有订阅者都已答复? [英] How to find out all subscribers to a JMS topic have replied?

查看:102
本文介绍了如何找出JMS主题的所有订阅者都已答复?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用HornetQ(在JBoss AS 6.0中),我想设置一个JMS主题,多个客户端可以订阅.

Using HornetQ (In JBoss AS 6.0) I would like to setup a JMS topic to which multiple clients can subscribe.

生产者定期向该主题发送一条带有回复目的地的消息,所有订阅者都应回复该目的地.

A producer periodically sends a message to this topic with a reply-to destination, to which all subscribers should reply.

我遇到的问题是我不确定如何检查所有订阅者是否确实答复过.

The problem I'm having is that I'm not entirely sure how to check that all subscribers have indeed replied.

一种解决方案是,每个订户在订阅后首先向该主题发送一条消息及其详细信息(也许是一些GUID).生产者会记住这些详细信息,并在以后使用它检查是否所有订阅的客户端都已答复.

One solution could be that each subscriber first sends a message to the topic after subscription with its details (perhaps some GUID). The producer remembers these details and uses it to check later whether all subscribed clients have replied.

但是,我不想使用自己发明的轮子,而是要使用已经存在的东西.这似乎是一个标准问题,但是我找不到任何现有的解决方案.

However, rather than inventing the wheel myself I would like to use something that already exists. This seems like a standard problem, but I could not find any existing solution.

推荐答案

您可以使用持久订阅,然后查询订阅和消息.
参见 http://hornetq.sourceforge.net/docs/hornetq-2.0.0.BETA5/user-manual/en/html/management.html#d0e5742

You could use durable subscriptions, and then query the subscriptions and messages.
See http://hornetq.sourceforge.net/docs/hornetq-2.0.0.BETA5/user-manual/en/html/management.html#d0e5742

请注意,使用持久订阅和持久消息将导致性能下降.您必须根据您的特定需求评估性能影响的严重性.

Note that usage of durable subscriptions and persistent messages will incur a performance penalty. You'll have to gauge the severity of the performance impact according to your specific needs.

这篇关于如何找出JMS主题的所有订阅者都已答复?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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