Hi,
I have chosen a strategy for the chat client that is probably not save. Given the IChatMessage service that has the "String getMessage()" method:
Sending
1. The user enters a message
2. unregisterOldService()
3. publishNewService()
ServiceListener for IChatService
1. Receive IChatMessage service REGISTER Event (including my own)
2. call getMessage() and put the result on the display
What I see is the following:
* The IChatMessage service REGISTER event is triggered at least twice.
I guess this is due to the way the service is distributed
* The discovery service needs to work hard. Sometimes a client misses a registration
* Zoodiscovery breaks contact with the client every xx seconds. On reconnect, the service is advertised again.
This leads to publishing of the same message
I guess this pattern needs some additional defensive code to be effective.
Another pattern we could use is to register a central chat manager (hub and spoke). Maybe one of the clients could take this role or the discovery server could do this.
Another pattern I can think of is not to make the IChatMessage as volatile as it is now (publish for one single message) but make it a persistent service that is used as the peer to peer communication channel.
I think discussing the pro's and con's of the various strategies could be the topic of our talk.
Cheers,
Wim