JXTA

net.jxta.endpoint
Interface MessageSender

All Superinterfaces:
MessageTransport

public interface MessageSender
extends MessageTransport

A MessageSender is a MessageTransport that is able to send messages to remote peers using some protocol. MessageSenders provide facilities for sending point-to-point (unicast) messages.

MessageSenders additionally describe themselves in terms of their abilities.

isConnectionOriented()
Indicates that the Message Transport can provide efficient transport of a series of messages to the same destination
{link@ #allowRouting()}
Indicates that the Message Transport can be used in the routing of messages to destinations which are not directly reachable via this transport.

See Also:
MessageTransport, Message, Messenger, EndpointService, MessageReceiver, MessagePropagater

Method Summary
 boolean allowsRouting()
          Returns true if the Message Transport can be used by the EndpointRouter.
 Messenger getMessenger(EndpointAddress dest, Object hint)
          Return a Messenger for sending messages to the specified destination EndpointAddress.
 EndpointAddress getPublicAddress()
          Returns the EndpointAddress which will be used as the source address for all messages sent by this message sender.
 boolean isConnectionOriented()
          Returns true if the Message Transport is connection oriented (like TCP/IP).
 boolean ping(EndpointAddress addr)
          Deprecated. This operation is often very expensive and usually duplicates the work of getMessenger(net.jxta.endpoint.EndpointAddress, java.lang.Object). If you want to determine the reachability of a destination, get a Messenger to the destination.
 
Methods inherited from interface net.jxta.endpoint.MessageTransport
getEndpointService, getProtocolName, transportControl
 

Method Detail

getPublicAddress

EndpointAddress getPublicAddress()
Returns the EndpointAddress which will be used as the source address for all messages sent by this message sender. This is the "preferred" address to which replies should be sent. This address is not necessarily the best or only address by which the peer may be reached.

The public address may also be for a different message transport.

Returns:
an EndpointAddress containing the public address for this message receiver.

isConnectionOriented

boolean isConnectionOriented()
Returns true if the Message Transport is connection oriented (like TCP/IP). Indicates that the Message Transport can provide efficient transport of a series of messages to the same destination.

Returns:
true if the Message Transport is connection oriented.

allowsRouting

boolean allowsRouting()
Returns true if the Message Transport can be used by the EndpointRouter. Indicates that the Message Transport can be used in the routing of messages to destinations which are not directly reachable via this transport.

More specifically, this Message Transport will be used to route messages who's final destination is not one of the endpoint addresses available from getReachableEndpointAddresses.

Returns:
true if the protocol can be used by the EndpointRouter

getMessenger

Messenger getMessenger(EndpointAddress dest,
                       Object hint)
Return a Messenger for sending messages to the specified destination EndpointAddress.

Parameters:
dest - The destination address for which a messenger is requested.
hint - An optional hint for the transport to use when creating the messenger. The format of the hint is specific to each Message Transport and may be null if no hint is provided.
Returns:
a Messenger or null if the destination is not reachable.

ping

@Deprecated
boolean ping(EndpointAddress addr)
Deprecated. This operation is often very expensive and usually duplicates the work of getMessenger(net.jxta.endpoint.EndpointAddress, java.lang.Object). If you want to determine the reachability of a destination, get a Messenger to the destination.

Returns true if the specified destination address is reachable via this Message Transport otherwise returns false.

Parameters:
addr - Address to ping
Returns:
true if the specified destination address is reachable via this Message Transport otherwise returns false.

JXSE