Embed akka serialization inside jackson serialization (#29455)

* Embed akka serialization inside jackson serialization

Allows re-use of existing serializers when embedding the types in
Jackson

* Fix false dead code warning

* Move marker trait and add docs

* Remove module and document adding annotations

* Review feedback
This commit is contained in:
Christopher Batey 2020-08-05 16:06:33 +01:00
parent 7348939ff4
commit 67eb74f076
8 changed files with 175 additions and 6 deletions

View file

@ -390,6 +390,20 @@ For the `jackson-cbor` and custom bindings other than `jackson-json` compression
but can be enabled in the same way as the configuration shown above but replacing `jackson-json` with
the binding name (for example `jackson-cbor`).
## Using Akka Serialization for embedded types
For types that already have an Akka Serializer defined that are embedded in types serialized with Jackson the @apidoc[AkkaSerializationSerializer] and
@apidoc[AkkaSerializationDeserializer] can be used to Akka Serialization for individual fields.
The serializer/deserializer are not enabled automatically. The `@JsonSerialize` and `@JsonDeserialize` annotation needs to be added
to the fields containing the types to be serialized with Akka Serialization.
The type will be embedded as an object with the fields:
* serId - the serializer id
* serManifest - the manifest for the type
* payload - base64 encoded bytes
## Additional configuration
### Configuration per binding

View file

@ -134,7 +134,13 @@ The factory returns a `Behavior` that can be spawned like any other behavior.
### Conflict free replicated data types
TODO example once CRDTs are in
The following CRDTs are included that can be used to build your own data model:
* @apidoc[LwwTime]
* @apidoc[Counter]
* @apidoc[akka.persistence.typed.crdt.ORSet]
Akka serializers are included for all these types and can be used to serialize when @ref[embedded in Jackson](../serialization-jackson.md#using-akka-serialization-for-embedded-types).
### Last writer wins