RE: Individual Members of PeerGroup

"Vitaly Vainer" <[email protected]> Thu, 8 Sep 2005 14:29:14 +0300
Newsgroups gmane.comp.java.jxta.user
Message-ID <[email protected]>
It worked for me; I never did load/performance tests of it.

 

Vitaly.

   _____  

From: Poole, Paul P1 [mailto:[email protected]] 
Sent: Thursday, September 08, 2005 2:22 PM
To: [email protected]
Subject: RE: [JXTA user] Individual Members of PeerGroup

 

Thanks Vitaly,

 

The only problem with that solution is that I don't know ahead of time who I
want to send it to...  If there are 10 in a group, I want to randomly send
the message to a few of them... alternating the recipients each time.  I
can't do that with the propagate pipe solution below.  

 

Do you have any insight about propagate(Enumeration destPeerIds, Message
msg, String serviceName, String serviceParam, int ttl)?

 

Thanks,

 

Paul

-----Original Message-----
From: Vitaly Vainer [mailto:[email protected]] 
Sent: Thursday, September 08, 2005 7:05 AM
To: [email protected]
Subject: RE: [JXTA user] Individual Members of PeerGroup

Hi Paul,

 

You may create input pipe with the same id on the peers you would like to
get your message and then use propagate output pipe with chosen id to send
message to all of them.

 

Create input pipe:

            byte [] CHOSEN_ID = new byte [] {…};  // your chosen id for
pipes

            …

            PeerGroup _group;  // your peer group

            ...

PipeAdvertisement pipeAd = (PipeAdvertisement)
AdvertisementFactory.newAdvertisement(PipeAdvertisement.getAdvertisementType
());       

            pipeAd.setPipeID(IDFactory.newPipeID(_group.getPeerGroupID(),
CHOSEN_ID));

            pipeAd.setType(_PipeService.PropagateType);   

            IntputPipe pipe =
_group.getPipeService().createIntputPipe(pipeAdv, new PipeMsgListener () {

                                    public void pipeMsgEvent(PipeMsgEvent
event)

                                    {

                                                // Do whatever you need when
getting new message

}

})

 

Create output pipe:

PipeAdvertisement pipeAd = (PipeAdvertisement)
AdvertisementFactory.newAdvertisement(PipeAdvertisement.getAdvertisementType
());       

            pipeAd.setPipeID(IDFactory.newPipeID(_group.getPeerGroupID(),
CHOSEN_ID));

            pipeAd.setType(_PipeService.PropagateType);   

            OutputPipe pipe =
_group.getPipeService().createOutputPipe(pipeAdv, PIPE_TIMEOUT)

 

 

 

Vitaly Vainer,

Content Objects, Israel.

 


   _____  


From: Poole, Paul P1 [mailto:[email protected]] 
Sent: Wednesday, September 07, 2005 10:38 PM
To: [email protected]
Subject: [JXTA user] Individual Members of PeerGroup

 

Hi all… 

I was wondering if some of you could enlighten me on the best way to send a
message to only a few members of a peer group.  I don't want to propagate
the message to every member of a group, just a few of them.  I know that
RendezVousService has a couple of methods that could work… 

One possibility is to use propagateInGroup() with a low TTL (like 1), but
that will probably send to more peers than desired.  

Another possibility, is to get an enumeration of the peerIDs currently
connected to the rendezvous and then use a subset of that with the
RendezvousService method propagate(Enumeration destPeerIds, Message msg,
String serviceName, String serviceParam, int ttl).  However, the API states
that this method is very expensive. Is it still expensive if I only use 2 or
3 peers?

Are there are any better solutions? 

Thanks in advance for your insight! 

Paul Poole
Software Engineer
Lockheed Martin 

 

 

--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.19/92 - Release Date: 07/09/2005

 

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.19/92 - Release Date: 07/09/2005


--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.19/92 - Release Date: 07/09/2005



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.19/92 - Release Date: 07/09/2005