Clarification needed: multiple peer services in a custom peergroup...
I know there are a lot of threads detailing how to create a custom peer group and add a service (or services) to it - these all make sense to me and I have working code. So thanks to everyone who has posted details on threads about this.
My problem is how to add multiple peers offering the same set of services...
I have a peer (peer1) that attempts to discover a custom peer group, if it can't (indicating it is the first peer to come into existence), then it creates it. During the process of creating the peer group it adds a few services and an application to the group and then publishes the advertisement. (This part works fine)
Upon doing peer1.customGroup.startApp(null); everything goes fine.
My problem is when a second peer (peer2) comes online, it discovers the peergroup (created by peer1) no problem, but I then need it to join the peergroup and offer the same set of services as the first peer and start its own application instance. I am not sure how this should be done.
My question is really: upon discovering an existing peerGroup advert (offering custom services), how does one then join that group and start up new 'instances' of those services.
What does the second peer need to extract from the existing advertisement of the group that it has found? what does it need to remotely advertise itself? etc.... It doesn't make sense that the second peer should have to go through the process of creating the same custom PeerGroup and adding the same set of services and so on...
I may be wrong, but there appears to be major gap in the JXTA sample code/tutorials out there. Almost every example I can find online details how a peer creates a peer group and offers services OR how to discover a peer group and use services, but practically none deal with discovering a peer group and becoming another service offerer.
Any help would be much appreciated