Find serializer by looking at interfaces and super classes. See #1766
This commit is contained in:
parent
370e2d9818
commit
612e909c48
6 changed files with 163 additions and 32 deletions
|
|
@ -91,14 +91,17 @@ public class SerializationDocTestBase {
|
|||
serializers {
|
||||
default = "akka.serialization.JavaSerializer"
|
||||
java = "akka.serialization.JavaSerializer"
|
||||
proto = "akka.serialization.ProtobufSerializer"
|
||||
myown = "akka.docs.serialization.MyOwnSerializer"
|
||||
}
|
||||
|
||||
serialization-bindings {
|
||||
java = ["java.lang.String",
|
||||
"app.my.Customer"]
|
||||
proto = ["com.google.protobuf.Message"]
|
||||
myown = ["my.own.BusinessObject",
|
||||
"something.equally.Awesome",
|
||||
"akka.docs.serialization.MyOwnSerializable"
|
||||
"java.lang.Boolean"]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,8 +39,26 @@ should be serialized using which ``Serializer``, this is done in the "akka.actor
|
|||
|
||||
.. note::
|
||||
|
||||
Akka currently only checks for absolute equality of Classes, i.e. it does not yet check ``isAssignableFrom``,
|
||||
this means that you'll need to list the specific classes.
|
||||
You only need to specify the name of an interface or abstract base class if the messages implements
|
||||
that. E.g. ``com.google.protobuf.Message`` for protobuf serialization.
|
||||
|
||||
Protobuf
|
||||
--------
|
||||
|
||||
Akka provides a ``Serializer`` for `protobuf <http://code.google.com/p/protobuf/>`_ messages.
|
||||
To use that you need to add the following to the configuration::
|
||||
|
||||
akka {
|
||||
actor {
|
||||
serializers {
|
||||
proto = "akka.serialization.ProtobufSerializer"
|
||||
}
|
||||
|
||||
serialization-bindings {
|
||||
proto = ["com.google.protobuf.Message"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Verification
|
||||
------------
|
||||
|
|
@ -74,6 +92,7 @@ here's some examples:
|
|||
|
||||
For more information, have a look at the ``ScalaDoc`` for ``akka.serialization._``
|
||||
|
||||
|
||||
Customization
|
||||
=============
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue