Class AddressFormatter
Built-in IAkkaMessagePackFormatter<T> for Address.
Implements
Inherited Members
Namespace: Akka.Serialization.V2
Assembly: Akka.Serialization.V2.dll
Syntax
public sealed class AddressFormatter : IAkkaMessagePackFormatter<Address>
Remarks
The wire format is byte-identical to Akka.Remote's hand-rolled Artery control-message
serializer (ArteryControlMessageSerializer.WriteAddress / ReadAddress /
SizeOfAddress): a 4-element array of [Protocol, System, Host-or-nil, Port-or-nil].
Registering this formatter via AkkaSerializerFormatterAttribute lets
Address fields be used on any generated serializer, including ones that must
interoperate with that hand-rolled format.
Methods
| Edit this page View SourceRead(ref MessagePackReader)
Reads a Address value previously written by Write(ref MessagePackWriter, T).
Declaration
public Address Read(ref MessagePackReader reader)
Parameters
| Type | Name | Description |
|---|---|---|
| MessagePackReader | reader | The MessagePack reader cursor. |
Returns
| Type | Description |
|---|---|
| Address |
SizeOf(Address)
Returns the exact encoded byte count for value, or
UnknownSize when the exact size cannot be
cheaply computed.
Declaration
public int SizeOf(Address value)
Parameters
| Type | Name | Description |
|---|---|---|
| Address | value | The value whose encoded size is being computed. |
Returns
| Type | Description |
|---|---|
| int |
Remarks
For transport-sensitive formatters (anything whose encoding consults the thread-static transport context, such as ActorPathFormatter), SizeOf(T) and Write(ref MessagePackWriter, T) read that context independently: both calls must run under the same transport scope on the same thread for the exact-size contract to hold. The generated serializers and the Artery encode path satisfy this naturally by sizing and writing within one serialization scope.
Write(ref MessagePackWriter, Address)
Writes value to writer.
Declaration
public void Write(ref MessagePackWriter writer, Address value)
Parameters
| Type | Name | Description |
|---|---|---|
| MessagePackWriter | writer | The MessagePack writer cursor. |
| Address | value | The value to write. Never null/absent for non-nullable fields. |
Remarks
Write MUST produce exactly ONE top-level MessagePack value; wrap multiple values in a
single array or map. The generated map framing and the unknown-field forward-compatibility
path (reader.Skip()) both depend on one field id mapping to one MessagePack value —
multiple top-level values desync older readers during rolling upgrades.
Edit this page