activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Oestreicher <>
Subject peer protocol - wait for discovery
Date Fri, 04 Nov 2011 15:37:07 GMT

I'm working on a multi-user Swing application where it would be nice if 
users could be informed about updates made by others in real-time. For 
this application it is pretty much a convenience feature so it's not 
necessary for correct operation.
After looking into ActiveMQ I discovered the Peer protocol which seems 
to be exactly what I need because I don't want to use a central server. 
I made a small test example which seemed to work perfectly.

But one thing I would like to do is send a message on application start 
to announce the client to the others.  Unfortunately I'm not sure how to 
get this to work because if I immediately send a message after starting 
the connection it's only delivered to the embedded broker. Calling 
Thread.sleep for a short time before sending the message makes it work. 
So I guess that's because it takes some time until the discovery is 
finished, but how can I wait for that? I stumbled upon Advisories and it 
sounds like maybe that's what I need but I'm having a hard time finding 
more information about this. I'm quite new to JMS so please forgive my 

I would appreciate any pointers.

You can see the relevant part of the test code I used here, in case it 
makes any difference:


View raw message