Skip to main content

Clarification needed: multiple peer services in a custom peergroup...

5 replies [Last post]
dave_scullion
Offline
Joined: 2007-03-19

Hello all,

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

Kind regards

David

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
bondolo
Offline
Joined: 2003-06-11

> 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.

In most typical applications peers will not be joining arbitrary peer groups so they will only encounter peer group advertisements for groups they know how to join. The custom services are normally provided as part of the application deployment so all peers have all of the required services.

java4me
Offline
Joined: 2006-03-09

Can a peer join a peer group (that implements a set of services) and yet not provide an implementation of some of the services offered by the group? Must peer group service impl bytecode reside on each machine in which a peer process (which desires to access the service by joining the group) runs?

adamman71
Offline
Joined: 2007-01-31

A service is attached at a peer or a peer group level. So if you have registered your service at a peer group level and the peers joining it bring their own, there is going to be a 'conceptual' conflict. Each will have a different ID...

J.

dave_scullion
Offline
Joined: 2007-03-19

Problem overcome... Please ignore

java4me
Offline
Joined: 2006-03-09

Dave,

Could you provide me a few details on how you overcame your problem. I have a similar one.

Thanks,
Jared