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
