Produces an object from an array of bytes, with an optional type-hint; the class should be loaded using ActorSystem.dynamicAccess.
Completely unique value to identify this implementation of Serializer, used to optimize network traffic.
Completely unique value to identify this implementation of Serializer, used to optimize network traffic. Values from 0 to 16 are reserved for Akka internal usage.
Return the manifest (type hint) that will be provided in the fromBinary method.
Return the manifest (type hint) that will be provided in the fromBinary method.
Use ""
if manifest is not needed.
Serializes the given object into an Array of Byte
Serializes the given object into an Array of Byte
Produces an object from an array of bytes, with an optional type-hint; the class should be loaded using ActorSystem.dynamicAccess.
Produces an object from an array of bytes, with an optional type-hint; the class should be loaded using ActorSystem.dynamicAccess.
Java API: deserialize with type hint
Java API: deserialize with type hint
Java API: deserialize without type hint
Java API: deserialize without type hint
Returns whether this serializer needs a manifest in the fromBinary method
Returns whether this serializer needs a manifest in the fromBinary method
A Serializer represents a bimap between an object and an array of bytes representing that object.
For serialization of data that need to evolve over time the
SerializerWithStringManifest
is recommended instead of Serializer because the manifest (type hint) is aString
instead of aClass
. That means that the class can be moved/removed and the serializer can still deserialize old data by matching on theString
. This is especially useful for Akka Persistence.The manifest string can also encode a version number that can be used in #fromBinary to deserialize in different ways to migrate old data to new domain objects.
If the data was originally serialized with Serializer and in a later version of the system you change to
SerializerWithStringManifest
the manifest string will be the full class name if you usedincludeManifest=true
, otherwise it will be the empty string.Serializers are loaded using reflection during akka.actor.ActorSystem start-up, where two constructors are tried in order:
Be sure to always use the [[akka.actor.DynamicAccess]] for loading classes! This is necessary to avoid strange match errors and inequalities which arise from different class loaders loading the same class.