简体   繁体   中英

Why are actor messages serializable?

Reading " http://doc.akka.io/docs/akka/snapshot/general/remoting.html " it states " all messages sent over the wire must be serializable" which in turn requires all messages sent to actor's are serializable. Why is it required that the actor be serializable ?

Is the reason that messages are sent between actors using serialization and deserialization ? Reason messages are sent/received using serialization is that potentially message could be sent to actors that reside on different JVM's ?

Messages don't technically need to be serializable unless they are actually sent across a process boundary. Best practice is that all messages should be serializable in order to maintain location transparency.

To enforce serializability for testing purposes, you can use the configuration akka.actor.serialize-messages=on , which will cause akka to always attempt to serialize messages even when sent locally.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM