保证某些消息不会被序列化
Guarantee that certain messages will not be serialized
假设,在某个状态下,一个akka actor A创建了一个child actor B:
Context.ActorOf(Props.Create(() => new BActor(RawDetails)));
RawDetails
是一个相当大但没有引用的简单对象,必须在包含许多引用的实际数据对象 SmartDetails
中进行转换。
SmartDetails
是在 BActor
的构造函数中创建的,现在必须发送给 akka actor A。
我必须保证SmartDetails
从B发给A时不会被序列化
这是在 akka 中进行的有效方式吗?
我们测试了它并且它有效,即它没有序列化。
我正在搜索文档,例如我可以找到一个声明,子演员是在与父演员相同的过程中创建的,并且不会发生序列化。
当消息 SmartDetails
序列化时,akka 会崩溃,因为 SmartDetails
太大了。
原版 RawDetails
来自另一个演员以连载形式,"shipped" 装在简单的小包中。
默认情况下,同一个 ActorSystem
(同一个进程和 AppDomain)中的消息不会被序列化——这就是为什么它们不可变如此重要的原因。
文档在 "Verification" 部分提到了它 here:
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).
但是通过remoting/clustering发送到另一个actor系统的消息将被序列化。
假设,在某个状态下,一个akka actor A创建了一个child actor B:
Context.ActorOf(Props.Create(() => new BActor(RawDetails)));
RawDetails
是一个相当大但没有引用的简单对象,必须在包含许多引用的实际数据对象 SmartDetails
中进行转换。
SmartDetails
是在 BActor
的构造函数中创建的,现在必须发送给 akka actor A。
我必须保证SmartDetails
从B发给A时不会被序列化
这是在 akka 中进行的有效方式吗?
我们测试了它并且它有效,即它没有序列化。
我正在搜索文档,例如我可以找到一个声明,子演员是在与父演员相同的过程中创建的,并且不会发生序列化。
当消息 SmartDetails
序列化时,akka 会崩溃,因为 SmartDetails
太大了。
原版 RawDetails
来自另一个演员以连载形式,"shipped" 装在简单的小包中。
默认情况下,同一个 ActorSystem
(同一个进程和 AppDomain)中的消息不会被序列化——这就是为什么它们不可变如此重要的原因。
文档在 "Verification" 部分提到了它 here:
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).
但是通过remoting/clustering发送到另一个actor系统的消息将被序列化。