liveBook · Manning

Serialization

As explained in Kafka for Architects

Serialization is the process of converting structured data into a transferable representation such as bytes or text.

Serialization converts message keys and values into bytes for transfer, while deserialization converts those bytes back into meaningful objects. Kafka brokers transfer binary data without interpreting its content, so producers and consumers must agree on the format. section 3.1.4

Kafka applications determine serialization through client configuration:

  • Configure key.serializer and value.serializer independently; keys and values may use different serializers. section 3.1.4 section 3.2
  • Configure matching deserializers on consumers, because incompatible formats produce runtime errors. section 3.1.4
  • Choose primitive, JSON, schema-based, or custom implementations according to application and data-contract needs. section 3.1.4 section 3.1.6

Customer 360 producer configuration

A Customer 360 project considers JSON serialization and initially assigns StringSerializer to both keys and values. Its consumers must use corresponding StringDeserializer settings. The key type remains architecturally important: customer IDs preserve per-customer ordering, while transaction IDs help distribute load across partitions. section 3.1.6 section 2.4.2

key.serializer=org.apache.kafka.common.serialization.IntegerSerializer
value.serializer=org.apache.kafka.common.serialization.StringSerializer

Use the compact producer configuration to inspect separate key and value serializer assignments. section 3.1.4

Figure 3.7 Producer message-sending workflow in Kafka
A screenshot of a computer screen

AI-generated content may be incorrect.

Use the producer workflow figure to trace serialization from message creation through batching, partitioning, replication, and acknowledgment. section 3.2

How Kafka for Architects covers it

How deep it goes
Explains client configuration and runtime consequences, then traces serialization through batching and delivery without implementing custom serializers.
Examples
Uses primitive serializer configurations, JSON in a Customer 360 project, and AsyncAPI message definitions.
What it assumes
Assumes Kafka client and producer-consumer concepts, while defining binary transfer and format agreement through concrete configurations.
What you can do after
Operate/configure Kafka clients by selecting compatible serializers and deserializers and documenting shared message formats.
How it connects
Connects serialization with deserialization, Kafka producers, consumers, message keys, partitions, data contracts, and AsyncAPI.

Also explained in

Compare how 24 books explain serialization →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kafka for Architects. The section links point to the parts of the book it draws on.