akka.io
Class UdpMessage$

java.lang.Object
  extended by akka.io.UdpMessage$

public class UdpMessage$
extends java.lang.Object

Java API: factory methods for the message types used when communicating with the Udp service.


Field Summary
static UdpMessage$ MODULE$
          Static reference to the singleton instance of this Scala object.
 
Constructor Summary
UdpMessage$()
           
 
Method Summary
 Udp.Command bind(ActorRef handler, java.net.InetSocketAddress endpoint)
          Bind without specifying options.
 Udp.Command bind(ActorRef handler, java.net.InetSocketAddress endpoint, java.lang.Iterable<Inet.SocketOption> options)
          Send this message to the UdpExt.manager() in order to bind to the given local port (or an automatically assigned one if the port number is zero).
 Udp.NoAck noAck()
          Default Udp.NoAck instance which is used when no acknowledgment information is explicitly provided.
 Udp.NoAck noAck(java.lang.Object token)
          Each Udp.Send can optionally request a positive acknowledgment to be sent to the commanding actor.
 Udp.Command resumeReading()
          This message must be sent to the listener actor to re-enable reading from the socket after a Udp.SuspendReading command.
 Udp.Command send(ByteString payload, java.net.InetSocketAddress target)
          The same as send(payload, target, noAck()).
 Udp.Command send(ByteString payload, java.net.InetSocketAddress target, Udp.Event ack)
          This message is understood by the &ldquo;simple sender&rdquo; which can be obtained by sending the Udp.SimpleSender query to the UdpExt.manager() as well as by the listener actors which are created in response to Udp.Bind.
 Udp.Command simpleSender()
          Retrieve a simple sender without specifying options.
 Udp.Command simpleSender(java.lang.Iterable<Inet.SocketOption> options)
          Retrieve a reference to a &ldquo;simple sender&rdquo; actor of the UDP extension.
 Udp.Command suspendReading()
          Send this message to a listener actor (which sent a Udp.Bound message) to have it stop reading datagrams from the network.
 Udp.Command unbind()
          Send this message to the listener actor that previously sent a Udp.Bound message in order to close the listening socket.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODULE$

public static final UdpMessage$ MODULE$
Static reference to the singleton instance of this Scala object.

Constructor Detail

UdpMessage$

public UdpMessage$()
Method Detail

noAck

public Udp.NoAck noAck(java.lang.Object token)
Each Udp.Send can optionally request a positive acknowledgment to be sent to the commanding actor. If such notification is not desired the Udp.Send.ack() must be set to an instance of this class. The token contained within can be used to recognize which write failed when receiving a Udp.CommandFailed message.

Parameters:
token - (undocumented)
Returns:
(undocumented)

noAck

public Udp.NoAck noAck()
Default Udp.NoAck instance which is used when no acknowledgment information is explicitly provided. Its &ldquo;token&rdquo; is null.

Returns:
(undocumented)

send

public Udp.Command send(ByteString payload,
                        java.net.InetSocketAddress target,
                        Udp.Event ack)
This message is understood by the &ldquo;simple sender&rdquo; which can be obtained by sending the Udp.SimpleSender query to the UdpExt.manager() as well as by the listener actors which are created in response to Udp.Bind. It will send the given payload data as one UDP datagram to the given target address. The UDP actor will respond with Udp.CommandFailed if the send could not be enqueued to the O/S kernel because the send buffer was full. If the given ack is not of type Udp.NoAck the UDP actor will reply with the given object as soon as the datagram has been successfully enqueued to the O/S kernel.

The sending UDP socket&rsquo;s address belongs to the &ldquo;simple sender&rdquo; which does not handle inbound datagrams and sends from an ephemeral port; therefore sending using this mechanism is not suitable if replies are expected, use Udp.Bind in that case.

Parameters:
payload - (undocumented)
target - (undocumented)
ack - (undocumented)
Returns:
(undocumented)

send

public Udp.Command send(ByteString payload,
                        java.net.InetSocketAddress target)
The same as send(payload, target, noAck()).

Parameters:
payload - (undocumented)
target - (undocumented)
Returns:
(undocumented)

bind

public Udp.Command bind(ActorRef handler,
                        java.net.InetSocketAddress endpoint,
                        java.lang.Iterable<Inet.SocketOption> options)
Send this message to the UdpExt.manager() in order to bind to the given local port (or an automatically assigned one if the port number is zero). The listener actor for the newly bound port will reply with a Udp.Bound message, or the manager will reply with a Udp.CommandFailed message.

Parameters:
handler - (undocumented)
endpoint - (undocumented)
options - (undocumented)
Returns:
(undocumented)

bind

public Udp.Command bind(ActorRef handler,
                        java.net.InetSocketAddress endpoint)
Bind without specifying options.

Parameters:
handler - (undocumented)
endpoint - (undocumented)
Returns:
(undocumented)

unbind

public Udp.Command unbind()
Send this message to the listener actor that previously sent a Udp.Bound message in order to close the listening socket. The recipient will reply with an Udp.Unbound message.

Returns:
(undocumented)

simpleSender

public Udp.Command simpleSender(java.lang.Iterable<Inet.SocketOption> options)
Retrieve a reference to a &ldquo;simple sender&rdquo; actor of the UDP extension. The newly created &ldquo;simple sender&rdquo; will reply with the Udp.SimpleSenderReady notification.

The &ldquo;simple sender&rdquo; is a convenient service for being able to send datagrams when the originating address is meaningless, i.e. when no reply is expected.

The &ldquo;simple sender&rdquo; will not stop itself, you will have to send it a PoisonPill when you want to close the socket.

Parameters:
options - (undocumented)
Returns:
(undocumented)

simpleSender

public Udp.Command simpleSender()
Retrieve a simple sender without specifying options.

Returns:
(undocumented)

suspendReading

public Udp.Command suspendReading()
Send this message to a listener actor (which sent a Udp.Bound message) to have it stop reading datagrams from the network. If the O/S kernel&rsquo;s receive buffer runs full then subsequent datagrams will be silently discarded. Re-enable reading from the socket using the Udp.ResumeReading command.

Returns:
(undocumented)

resumeReading

public Udp.Command resumeReading()
This message must be sent to the listener actor to re-enable reading from the socket after a Udp.SuspendReading command.

Returns:
(undocumented)