liveBook · Manning

Serde

As explained in Akka in Action, Second Edition

A SerDe is a serializer-deserializer component that converts structured data to and from a storable or transferable representation.

A SerDe (serializer-deserializer) converts structured actor messages and persistent events into storable representations and reconstructs them when needed. Persistent actors use it to restore events from a journal. section 9.3.5

In an event-sourced Akka application, a SerDe governs several operational details:

  • It binds persisted events to a format such as CborSerializable, Jackson CBOR, or Jackson JSON. section 9.3.5 section 9.4
  • It must deserialize older event versions when application schemas evolve. section 9.3.5
  • Akka serializers use identifiers from 0 through 40; custom SerDes must use an identifier above 40. section 9.4
  • Serialized events remain immutable journal facts; compatibility should accommodate old data rather than rewrite it. section 9.3.5

Evolving AddCargo

An event initially records AddCargo(id, kind, size). A later version adds loadedBy, producing a newer CargoAdded shape. Older journal entries lack that field, so compatible deserialization must interpret multiple versions and load old events into the new event type without changing the journal. section 9.3.5

Table 9.1 Journal entries in the database table public.journal_events (view table figure)

ordering

persistence_id

sequence _number

deleted

event_ser_id

event_payload

event_ser_id

1

SPContainer -type-key|9

1

false

33

binary data

33

2

SPContainer -type-key|9

2

false

33

binary data

33

3

SPContainer -type-key|11

3

false

33

binary data

33

The journal table shows where the serializer identifier and binary event payload are stored alongside persistence and sequence metadata. section 9.4

How Akka in Action, Second Edition covers it

How deep it goes
Explains storage bindings, serializer identifiers, and version compatibility, but stops short of custom serializer implementation details.
Examples
Uses evolving AddCargo and CargoAdded events plus a journal table containing binary payloads and serializer identifiers.
What you can do after
Operate/configure event persistence and evaluate serializer strategies for safely reading older event schemas.
How it connects
Connects event sourcing with persistent actors, schema evolution, event journals, Jackson, Google Protocol Buffers, and custom serializers.

Also explained in

Compare how 2 books explain Serde →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Akka in Action, Second Edition. The section links point to the parts of the book it draws on.