blue-sky
blue-sky

Reputation: 53826

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 ?

Upvotes: 0

Views: 421

Answers (1)

Eric Zoerner
Eric Zoerner

Reputation: 751

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.

Upvotes: 5

Related Questions