Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find out all subscribers to a JMS topic have replied?

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.

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.

like image 972
Arjan Tijms Avatar asked Nov 06 '22 03:11

Arjan Tijms


2 Answers

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.

like image 67
crowne Avatar answered Nov 12 '22 13:11

crowne


JMS itself doesn't support this, it's too simple. If you didn't mind coupling your code to HornetQ, then you could use its native API to find out this stuff. Not ideal, but it's well written and has readable source code, so it wouldn't be too hard.

like image 45
skaffman Avatar answered Nov 12 '22 13:11

skaffman