What is the default behavior for remoting serialization


I have a lot of messages and objects to send by Akka Cluster. These message and objects are not implements java.io.Serializable. I have tried some way. It looks it can work only by configuring serialization-bindings to add all these classes to use protocol buffer. The configure file like below

    serializers {
      proto = "akka.remote.serialization.ProtobufSerializer"
    serialization-bindings {
      "com.mysample.msg1" = proto
      "com.mysample.msg2" = proto

My question is:
1, is there a way let akka automatically use proto serialization for all java classes.
2, is there a way to set serialization-bindings for a package, e.g. com.mysample.*.
3, what’s the default behaviour if no configuration for the classes implementing java.io.Serializable. Will akka use java.io.Serializable to serialize objects?

Thanks in advance.

1 Like

Here’s how the default java serialization behavior is chosen:

You can override these settings if you want to.

For future Akka versions we will also move the default away from Java serialization, probably using jackson instead. You can watch this ticket for more information about that:


Thanks. I am now using kryo. Looks easy and no need to change java plain object to implements serializable.
From my understanding, specific serialization is the most cost effective, e.g. know the every byte of field or object then use small java data type to or bytes to write. protobuff may be the choice.