Video in progress

How do you choose between event-carried state transfer and "thin" notification events?

A thin event carries only "what changed" and the ID, and the consumer asks for the details through an API, so the coupling stays. A fat event brings the full state, the consumer works independently, but the schema is larger and data gets copied.

📖 Answer

Let's put the two options side by side:

{ "type": "CustomerUpdated", "customerId": 381 }
{ "type": "CustomerUpdated", "customerId": 381, "version": 17,
  "name": "Dilshod", "phone": "+99893...", "tier": "GOLD" }

With a thin event, every consumer makes a GET to customer-service after receiving the message. 10 consumers means 10 times the read load, and if customer-service goes down, all the consumers stop. That is a synchronous dependency in asynchronous clothing. On top of that, the state may have changed again by the time of the GET, which is sometimes a plus (always the latest) and sometimes confusing (the event and the state you read don't match).

With a fat event, the consumer updates its own local copy (a read model) and never calls customer-service. Independence and availability are better. The cost:

  • the schema is big and every field becomes a public contract;
  • personal data spreads to many places;
  • ordering matters: you need to check by version so an old event doesn't overwrite a newer one.

I usually prefer fat events, but "fat" doesn't mean "all the entity's fields". I include the stable fields consumers really need. Internal technical fields (audit, internal flags) don't go into the event.

I use a thin event when the data is very large (files, long documents) or very sensitive: there the consumer fetches it from the API with an access check.

In Kafka, a compacted topic and a fat event work together very well: the topic itself keeps each customer's latest state, and a new service can build its own copy from scratch.