liveBook · Manning

Serialization

As explained in Microservices Patterns, Second Edition

Serialization is the conversion of in-memory data into a format suitable for transmission or storage.

In an API client, serialization converts outbound DTOs into the service’s expected payload format; deserialization maps incoming payloads into domain objects the application can use. section 8.1.7

Choose a message data model from these implementation options:

Binary payloads almost always use generated DTOs; text-based payloads also allow handwritten DTOs or untyped structures. Weigh development effort, schema correctness, type safety, and design-time coupling. section 8.1.7

Figure 8.3 An API client must have a data model of the messages that it exchanges with the service. The data model must serialize and deserialize correctly as defined by the schema. It can either be untyped (e.g. hash maps) or consist of handwritten or code-generated classes.
defining api client dtos

Compare untyped, handwritten, and generated message data models, all of which must serialize and deserialize according to the schema. section 8.1.7

How Microservices Patterns, Second Edition covers it

How deep it goes
Defines outbound and inbound conversions, compares DTO implementation options, and identifies selection factors without detailing their trade-offs.
Examples
Uses requests, commands, events, responses, replies, and consumed events as message payloads.
What you can do after
Apply it by serializing outbound DTOs and deserializing inbound payloads in an API client.
How it connects
Connects serialization to API clients, data transfer objects, message schemas, and deserialization.

Also explained in

Compare how 27 books explain serialization →

Related concepts

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