liveBook · Manning

Data format

As explained in Kafka for Architects

A data format is a defined representation and structure for encoding data exchanged between software components.

A data format defines how data exchanged between software components is represented. In a Kafka event flow, producers and consumers need a shared understanding of message structure and serialization: Kafka brokers do not enforce either. A producer can write bytes that a consumer cannot interpret, so the agreement must be documented and implemented by the participating teams. section 2.4.2 section 3.1.4 section 6.5.1

Event design starts with a logical structure, then moves to a concrete format for implementation. That move requires decisions about supported types, nullable fields, nested structures, and how changes will affect consumers. A schema can serve as a language-independent contract for the event’s fields and rules; the serialization framework determines how the data is encoded and how the schema is used. section 6.2.1 section 6.3.1

Common choices have different architectural trade-offs:

  • Avro uses a schema to produce compact binary data. Its schemas support fields, optionality, and nested records; data is not human-readable without interpretation. section 6.3.1
  • Protobuf also uses a schema and compact binary data, with its own schema syntax. section 6.3.1
  • JSON Schema describes JSON-based data. Both schema and data are human-readable, but the comparison identifies larger data size and less robust compatibility rules. section 6.3.1
Table 6.1 Comparison of different data formats

Feature

Avro

JSON Schema

Protobuf

Data serialization format

Binary

Text (JSON-based)

Binary

Schema definition language

JSON-based schema definition or Avro IDL (Interface Definition Language)

JSON-based schema definition

Protobuf-specific syntax

Compatibility

Strong compatibility
rules

Less robust due to open content model

Strong compatibility
rules

Data size

Compact

Larger size

Compact

Human readability

Schema is human-readable; data is not

Both schema and data are human-readable

Schema is human-readable; data is not

Performance

High

Lower

High

Support for complex types

Supported

Limited

Supported

Programming language support

Broad (Java, Python,
C++, Go, etc.)

Broad (any JSON-supporting language)

Broad (Java, Python, C++, Go, etc.)

Compare serialization, readability, data size, compatibility, and complex-type support before selecting a format. section 6.3.1

Choosing a format for a customer-data flow

A Customer 360 operational data store needs to exchange events across teams. JSON is familiar, but Avro is chosen for its tooling, community support, performance, and schema flexibility. The decision still needs a documented message structure and matching producer and consumer configuration. Topic keys are a separate architectural choice: a customer ID preserves the order of updates for that customer. section 6.3.2 section 2.4.2 section 3.1.4

The format agreement has operational consequences. A message with missing required fields or incompatible serialization may repeatedly stop a consumer at the same offset; brokers will not reject it on arrival. Test consumers against malformed messages, define a policy for handling them, and monitor any dead-letter topic used for review. In Kafka Connect, format-specific converters translate between Kafka data and ConnectRecord, while connectors handle external systems’ native formats. section 6.5.1 section 7.3.3

How Kafka for Architects covers it

How deep it goes
Explains schema and serialization roles, compares three formats, and traces wrong-format failures; stops short of a full implementation walkthrough.
Examples
Uses customer-data events, a Client schema, serializer settings, and a format comparison table.
What it assumes
Assumes familiarity with Kafka producers, consumers, and topics; introduces schema-format choices through examples rather than from programming fundamentals.
What you can do after
Evaluate/understand format trade-offs, document an event structure, align clients, and plan for invalid messages.
How it connects
Connects data formats to event schemas, data contracts, serializers, deserializers, Kafka Connect converters, and dead-letter topics.

Also explained in

Compare how 4 books explain data format →

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.