RE: Individual Members of PeerGroup

"Poole, Paul P1" <[email protected]> Thu, 08 Sep 2005 10:35:18 -0400
Newsgroups gmane.comp.java.jxta.user
Message-ID <[email protected]>
I have considered the unicast pipe in a loop scenario as well.  I am
wondering if the unicast loop would be equally, more, or less expensive
than the propagate method.  
 
Anyone have any thoughts on this?
 
Thank you Vitaly for your suggestions... They have been most helpful.
 
Paul
 
 
-----Original Message-----
From: Vitaly Vainer [mailto:[email protected]] 
Sent: Thursday, September 08, 2005 9:17 AM
To: [email protected]
Subject: RE: [JXTA user] Individual Members of PeerGroup



	I don't use it in my application, but I tested it and found it
fully functional for sending message to subset of peers (in my case I
can use solution proposed below). On other hand if subset is very small
then you just can use unicast pipe in a loop :-)

	 

	Regards,

	Vitaly.

	 

	
  _____  


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

	 

	When you used it, did you use it for a subset of the members or
did you use it to propagate messages to all of the members?  My thought
is that if I use it for only a few members, then it shouldn't be too
expensive.

	 

	Thanks for your help...

	 

	Paul

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

		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.getAdvertisement
Type());       

	
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.getAdvertisement
Type());       

	
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


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