Write, then read

HR hires someone. Create them in both architectures, then read them back straight away. Federation writes to the owner and reads from the owner, so the new person is there at once. The event-driven side writes to the owner too, but reads from a copy that an event has to reach first.

Ready

GraphQL Federation

Mutation → router → HR subgraph → HR database. The response means the row is committed where every read will look.

mutation {
  createPerson(name: "…", email: "…") { id name }
}

Run it.

Read right after the write
–
Console

    

Event-driven projection

POST → HR events service → HR database and outbox row, one transaction. The response comes back now; the projection catches up after.

POST /api/persons
{ "name": "…", "email": "…", "hireDate": "…" }
Read right after the write
–
Console

    
The race is the lesson: the event-driven write returns as fast or faster, but a read straight after it usually finds nothing, because the event is still on its way. Screens built on projections either wait for the event, show the write optimistically, or read that one record from its owner. The two sides also create different ids: in this demo they are separate systems, as they were in the Apollo version.