liveBook · Manning

Event-carried state transfer

As explained in Kafka for Architects

Event-carried state transfer is an integration pattern in which events carry the producer's state so consumers can maintain local representations without requesting the state separately.

Event-carried state transfer (ECST) publishes an event containing the producer’s complete entity state, allowing consumers to maintain local representations without requesting state separately. It fits publish-subscribe integration: producers expose a stable, comprehensive event interface without knowing which attributes future consumers will need. section 6.2.2

ECST contrasts with delta events. A fact event carries every profile attribute even when only one field changes; a delta event carries only the changed value. Full-state events simplify consumer onboarding and recovery because consumers can reconstruct current state by reading the latest event, while consumer-specific logic remains on the consumer side. section 6.2.2

Listing 6.1 UserProfileUpdated event carrying all the attributes from the user profile
{
  "eventType": "UserProfileUpdated",
  "eventId": "123e4567-e89b-12d3-a456-426614174003",
  "timestamp": "2024-09-26T12:00:00Z",
  "userProfile": {
    "userId": "12345",
    "name": "Alice Johnson",
    "email": "alice.johnson@example.com",
    "preferredLanguage": "en",
    "addresses": [
      {
        "addressId": "98765",
        "street": "456 Elm St",
        "city": "Metropolis",
        "state": "NY",
        "zipCode": "10001"
      }
    ],
    "socialAccounts": [
      {
        "type": "twitter",
        "handle": "@alicejohnson"
      }
    ],
    "phoneNumber": "+1-555-123-4567"
  }
}

A UserProfileUpdated event demonstrates ECST by carrying identity, contact details, preferences, addresses, and social accounts together, even when one attribute changes. section 6.2.2

How Kafka for Architects covers it

How deep it goes
Defines fact events, contrasts delta events, and explains design, maintenance, resilience, and consumer-decoupling implications.
Examples
Uses a UserProfileUpdated event containing a complete user profile, contrasted with a phone-number-only update event.
What you can do after
Build it from scratch by designing producer-owned fact events that provide complete, consistent entity state to consumers.
How it connects
Connects fact events and delta events with publish-subscribe and event-driven decoupling.

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.