UdpConnected

org.apache.pekko.io.UdpConnected

UDP Extension for Akka’s IO layer.

This extension implements the connectionless UDP protocol with calling connect on the underlying sockets, i.e. with restricting from whom data can be received. For “unconnected” UDP mode see Udp.

For a full description of the design and philosophy behind this IO implementation please refer to the Pekko online documentation.

The Java API for generating UDP commands is available at UdpConnectedMessage.

Attributes

Source
UdpConnected.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

trait Command extends HasFailureMessage, Message

The common type of all commands supported by the UDP implementation.

The common type of all commands supported by the UDP implementation.

Attributes

Source
UdpConnected.scala
Supertypes
trait Message
trait HasFailureMessage
class Object
trait Matchable
class Any
Known subtypes
class Connect
object Disconnect
object ResumeReading
class Send
final case class CommandFailed(cmd: Command) extends Event

When a command fails it will be replied to with this message type, wrapping the failing command object.

When a command fails it will be replied to with this message type, wrapping the failing command object.

Attributes

Source
UdpConnected.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Event
trait Message
class Object
trait Matchable
class Any
Show all
final case class Connect(handler: ActorRef, remoteAddress: InetSocketAddress, localAddress: Option[InetSocketAddress] = ..., options: Iterable[SocketOption] = ...) extends Command

Send this message to the UdpExt#manager in order to bind to a local port (optionally with the chosen localAddress) and create a UDP socket which is restricted to sending to and receiving from the given remoteAddress. All received datagrams will be sent to the designated handler actor.

Send this message to the UdpExt#manager in order to bind to a local port (optionally with the chosen localAddress) and create a UDP socket which is restricted to sending to and receiving from the given remoteAddress. All received datagrams will be sent to the designated handler actor.

Attributes

Source
UdpConnected.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Command
trait Message
trait HasFailureMessage
class Object
trait Matchable
class Any
Show all
case object Connected extends Connected

Attributes

Companion
trait
Source
UdpConnected.scala
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait Connected
trait Event
trait Message
class Object
trait Matchable
class Any
Show all
Self type
Connected.type
sealed trait Connected extends Event

This message is sent by the connection actor to the actor which sent the Connect message when the UDP socket has been bound to the local and remote addresses given.

This message is sent by the connection actor to the actor which sent the Connect message when the UDP socket has been bound to the local and remote addresses given.

Attributes

Companion
object
Source
UdpConnected.scala
Supertypes
trait Event
trait Message
class Object
trait Matchable
class Any
Known subtypes
object Connected
case object Disconnect extends Command

Send this message to a connection actor (which had previously sent the Connected message) in order to close the socket. The connection actor will reply with a Disconnected message.

Send this message to a connection actor (which had previously sent the Connected message) in order to close the socket. The connection actor will reply with a Disconnected message.

Attributes

Source
UdpConnected.scala
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait Command
trait Message
trait HasFailureMessage
class Object
trait Matchable
class Any
Show all
Self type
Disconnect.type
case object Disconnected extends Disconnected

Attributes

Companion
trait
Source
UdpConnected.scala
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait Disconnected
trait Event
trait Message
class Object
trait Matchable
class Any
Show all
Self type
sealed trait Disconnected extends Event

This message is sent by the connection actor to the actor which sent the Disconnect message when the UDP socket has been closed.

This message is sent by the connection actor to the actor which sent the Disconnect message when the UDP socket has been closed.

Attributes

Companion
object
Source
UdpConnected.scala
Supertypes
trait Event
trait Message
class Object
trait Matchable
class Any
Known subtypes
object Disconnected
trait Event extends Message

The common type of all events emitted by the UDP implementation.

The common type of all events emitted by the UDP implementation.

Attributes

Source
UdpConnected.scala
Supertypes
trait Message
class Object
trait Matchable
class Any
Known subtypes
trait Connected
object Connected
trait Disconnected
object Disconnected
class NoAck
object NoAck
class Received
Show all
sealed trait Message

The common interface for Command and Event.

The common interface for Command and Event.

Attributes

Source
UdpConnected.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait Command
class Connect
object Disconnect
object ResumeReading
class Send
trait Event
trait Connected
object Connected
trait Disconnected
object Disconnected
class NoAck
object NoAck
class Received
Show all
case class NoAck(token: Any) extends Event

Each Send can optionally request a positive acknowledgment to be sent to the commanding actor. If such notification is not desired the 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 CommandFailed message.

Each Send can optionally request a positive acknowledgment to be sent to the commanding actor. If such notification is not desired the 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 CommandFailed message.

Attributes

Companion
object
Source
UdpConnected.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Event
trait Message
class Object
trait Matchable
class Any
Show all
Known subtypes
object NoAck
object NoAck extends NoAck

Default NoAck instance which is used when no acknowledgment information is explicitly provided. Its “token” is null.

Default NoAck instance which is used when no acknowledgment information is explicitly provided. Its “token” is null.

Attributes

Companion
class
Source
UdpConnected.scala
Supertypes
trait Product
trait Mirror
class NoAck
trait Serializable
trait Product
trait Equals
trait Event
trait Message
class Object
trait Matchable
class Any
Show all
Self type
NoAck.type
final case class Received(data: ByteString) extends Event

When a connection actor receives a datagram from its socket it will send it to the handler designated in the Udp.Bind message using this message type.

When a connection actor receives a datagram from its socket it will send it to the handler designated in the Udp.Bind message using this message type.

Attributes

Source
UdpConnected.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Event
trait Message
class Object
trait Matchable
class Any
Show all
case object ResumeReading extends Command

This message must be sent to the listener actor to re-enable reading from the socket after a SuspendReading command.

This message must be sent to the listener actor to re-enable reading from the socket after a SuspendReading command.

Attributes

Source
UdpConnected.scala
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait Command
trait Message
trait HasFailureMessage
class Object
trait Matchable
class Any
Show all
Self type
final case class Send(payload: ByteString, ack: Any) extends Command

This message is understood by the connection actors to send data to their designated destination. The connection actor will respond with 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 NoAck the connection actor will reply with the given object as soon as the datagram has been successfully enqueued to the O/S kernel.

This message is understood by the connection actors to send data to their designated destination. The connection actor will respond with 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 NoAck the connection actor will reply with the given object as soon as the datagram has been successfully enqueued to the O/S kernel.

Attributes

Companion
object
Source
UdpConnected.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait Command
trait Message
trait HasFailureMessage
class Object
trait Matchable
class Any
Show all
object Send

Attributes

Companion
class
Source
UdpConnected.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Send.type
case object SuspendReading extends Command

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’s receive buffer runs full then subsequent datagrams will be silently discarded. Re-enable reading from the socket using the ResumeReading command.

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’s receive buffer runs full then subsequent datagrams will be silently discarded. Re-enable reading from the socket using the ResumeReading command.

Attributes

Source
UdpConnected.scala
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait Command
trait Message
trait HasFailureMessage
class Object
trait Matchable
class Any
Show all
Self type

Value members

Concrete methods

Is used by Pekko to instantiate the Extension identified by this ExtensionId, internal use only.

Is used by Pekko to instantiate the Extension identified by this ExtensionId, internal use only.

Attributes

Definition Classes
Source
UdpConnected.scala
override def get(system: ActorSystem): UdpConnectedExt

Java API: retrieve the UdpConnected extension for the given system.

Java API: retrieve the UdpConnected extension for the given system.

Attributes

Definition Classes
Source
UdpConnected.scala

Returns an instance of the extension identified by this ExtensionId instance. Java API For extensions written in Scala that are to be used from Java also, this method should be overridden to get correct return type.

Returns an instance of the extension identified by this ExtensionId instance. Java API For extensions written in Scala that are to be used from Java also, this method should be overridden to get correct return type.

override def get(system: ClassicActorSystemProvider): TheExtension = super.get(system)

Attributes

Definition Classes
Source
UdpConnected.scala
override def lookup: ExtensionId[_ <: Extension]

Returns the canonical ExtensionId for this Extension

Returns the canonical ExtensionId for this Extension

Attributes

Definition Classes
Source
UdpConnected.scala

Inherited methods

Returns an instance of the extension identified by this ExtensionId instance.

Returns an instance of the extension identified by this ExtensionId instance.

Attributes

Inherited from:
ExtensionId
Source
Extension.scala

Returns an instance of the extension identified by this ExtensionId instance.

Returns an instance of the extension identified by this ExtensionId instance.

Attributes

Inherited from:
ExtensionId
Source
Extension.scala
final override def equals(other: Any): Boolean

Compares the receiver object (this) with the argument object (that) for equivalence.

Compares the receiver object (this) with the argument object (that) for equivalence.

Any implementation of this method should be an equivalence relation:

  • It is reflexive: for any instance x of type Any, x.equals(x) should return true.
  • It is symmetric: for any instances x and y of type Any, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any instances x, y, and z of type Any if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.

If you override this method, you should verify that your implementation remains an equivalence relation. Additionally, when overriding this method it is usually necessary to override hashCode to ensure that objects which are "equal" (o1.equals(o2) returns true) hash to the same scala.Int. (o1.hashCode.equals(o2.hashCode)).

Value parameters

that

the object to compare against this object for equality.

Attributes

Returns

true if the receiver object is equivalent to the argument; false otherwise.

Definition Classes
ExtensionId -> Any
Inherited from:
ExtensionId
Source
Extension.scala
final override def hashCode: Int

Calculates a hash code value for the object.

Calculates a hash code value for the object.

The default hashing algorithm is platform dependent.

Note that it is allowed for two objects to have identical hash codes (o1.hashCode.equals(o2.hashCode)) yet not be equal (o1.equals(o2) returns false). A degenerate implementation could always return 0. However, it is required that if two objects are equal (o1.equals(o2) returns true) that they have identical hash codes (o1.hashCode.equals(o2.hashCode)). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the equals method.

Attributes

Returns

the hash code value for this object.

Definition Classes
ExtensionId -> Any
Inherited from:
ExtensionId
Source
Extension.scala