Reputation: 13407
Suppose, in a certain state, an akka actor A creates a child actor B:
Context.ActorOf(Props.Create(() => new BActor(RawDetails)));
RawDetails
is a fairly large but simple object without references that must be transformed in the actual data object SmartDetails
which contains many references.
SmartDetails
is created in the constructor of BActor
and must now be sent to akka actor A.
I must have the guarantee that SmartDetails
will not be serialized when sending it from B to A.
Is this a valid way to proceed in akka?
We tested it and it works, i.e. it is not serialized.
I am searching for documentation where e.g. I can find a statement that a child actor is created in the same process as the parent actor and that serialization will not take place.
When message SmartDetails
is serialized akka will crash because SmartDetails
is too big.
The original RawDetails
came from another actor in serialized form, and it was "shipped" in small simple packets.
Upvotes: 0
Views: 57
Reputation: 1197
By default messages within the same ActorSystem
(same process and AppDomain) are not serialized - hence why it's so important they be immutable.
The documentation mentions it here, under the "Verification" section:
Normally, messages sent between local actors (i.e. same CLR) do not undergo serialization. For testing, sometimes, it may be desirable to force serialization on all messages (both remote and local).
But messages sent to another actor system via remoting/clustering will be serialized.
Upvotes: 1