Thanks a lot Scott for your elaborate answer.
It is absolutely true that the dynamic nature of remote services should be considered very carefully, and appropriate measures should be taken. However, IMHO, I think that we also have similar problems with the local OSGI services, perhaps in a smaller scale. That is to say, the local services could also be lazy at initialization, or might be removed from the registry soon after. OSGI experts were always warning about this dynamism, that the service consumer should always be ready for not finding the desired service. Whiteboard pattern is a solution for this, since we are not
explicitly keeping listener references, but relying on the registry.
I checked the ChatServer/Client example app for the usage of Whiteboard pattern with remote services. Thanks to Markus and Wim, it is a good example indeed. They applied the idea that all of the clients distribute their listener services, thus, effectively creating a distributed environment. However, for this type of solution, role separation for server and client becomes blurry, leading problems such as the one Markus pointed out in his bug submission.
As a beginner in this field, I'd like you to excuse me if these following questions/theories sound too illogical. Here they are:
- Is it possible for the clients to register their listener services on the server? This way, the server wouldn't have to do any discovery, and keep on the server role. Then again, server should know which listener comes from which machine. This also sounds like a PUB/SUB mechanism.
- If this is too unlikely, is there any way to combine OSGI RS with a PUB/SUB provider using ECF? We could use OSGI RS for server services, and PUB/SUB for listener requirements.
Regards,
Muammer