liveBook · Manning

Delta

As explained in Apache Kafka in Action

A delta is a message representation containing only the changes to an object rather than its complete state.

When an inventory value changes, rewriting the product’s complete state can repeat unchanged fields. A delta message carries only the changed fields, such as a new stock level or price, rather than the entire object. section 3.2.1

Inventory changes

A products.stocks.changes topic might contain messages such as {"id":123,"stock":1000}, {"id":234,"price":2}, and {"id":345,"stock":60,"price":3}. A later message can change the name for product 234 without repeating its stock or price. section 3.2.1

Deltas are useful when:

  • Small changes occur frequently and repeating unchanged values would increase data volume. section 3.2.1
  • Consumers need to identify what changed since the previous message. section 3.2.1
  • A consumer can combine each change with suitable context or a complete state; an isolated delta is often insufficient. section 3.3
# One message per line
{"id": 123, "stock": 1000}
{"id": 234, "price": 2}
{"id": 345, "stock": 60, "price": 3}
{"id": 234, "name": "cola zero"}

Compare compact field-level updates with complete product-state messages to see how deltas avoid repeating unchanged data. section 3.2.1

How Apache Kafka in Action covers it

How deep it goes
Defines the representation and explains its storage and interpretation trade-offs, but does not detail reconstruction algorithms.
Examples
Demonstrates product stock, price, and name updates in a products.stocks.changes topic.
What it assumes
Assumes familiarity with objects, fields, and Kafka messages while contrasting deltas with complete states.
What you can do after
Evaluate when partial updates can reduce repeated data and when consumers need additional state or context.
How it connects
Contrasts deltas with states and relates them to Kafka topics, messages, and complete state.

Related concepts

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