Expand my Community achievements bar.

SOLVED

messaging questions, get subscribers

Avatar

Level 1
Hi all,



I would like to know if we can get a list of consumers who
subscribe to a destination?

because i want to know when the user is connected(with
authentication) and i want the list of them.



for the moment i use a producer to tell to each of connected
user that there is a new user connected but i don't know how i can
know when the users close the windows for exemple to tell to each
other that this user is disconnected.



Sorry for my lack of english and for information I'm not a
JMS current user



thanks

1 Accepted Solution

Avatar

Correct answer by
Level 1
you can get all the client subscribed to a particular
destination using following code

MessageBroker msgBroker =
MessageBroker.getMessageBroker(null);

MessageService service =
(MessageService)msgBroker.getService("message-service");



AsyncMessage msg = new AsyncMessage();

msg.setDestination("destination");

String clientID = UUIDUtils.createUUID(false);

msg.setClientId(clientID);

msg.setMessageId(UUIDUtils.createUUID(false));

msg.setHeader("ID", new Long(leagueId).toString());

Set subscribers = service.getSubscriberIds(msg,
true);

View solution in original post

2 Replies

Avatar

Correct answer by
Level 1
you can get all the client subscribed to a particular
destination using following code

MessageBroker msgBroker =
MessageBroker.getMessageBroker(null);

MessageService service =
(MessageService)msgBroker.getService("message-service");



AsyncMessage msg = new AsyncMessage();

msg.setDestination("destination");

String clientID = UUIDUtils.createUUID(false);

msg.setClientId(clientID);

msg.setMessageId(UUIDUtils.createUUID(false));

msg.setHeader("ID", new Long(leagueId).toString());

Set subscribers = service.getSubscriberIds(msg,
true);

Avatar

Level 1
Thanks SarveshKatariya,



I just don't understand why you create so many uid with the
setClient, setMessage and setHeader, i think that just an example
and i don't know why this leagueId is here , maybe is a variable of
another project.



Now i know that I need to study the java-flex API :)



one more time thanks for this answer