GraphQL Federation and Kafka, with Spring Boot and Micronaut

25 September 2026 graphqlfederationkafkamicronautspring-bootjavaoutbox
PDF The design sheet The full architecture and the verified references. Free, no email.
Thumbnail for GraphQL Federation and Kafka, with Spring Boot and Micronaut 29:09
Watch on YouTube, or read on below.
Run this yourself → Clone the repo, docker compose up, and watch it happen

Kafka was down. I placed an order anyway. One version of this checkout made the customer wait about sixty seconds, and then said no. The other said yes in a fraction of a second. Then I killed the service that said yes, before it could tell anyone. When everything came back, that order was paid.

Everything below was run on 25 September 2026 on Spring Boot 4.1.1, Micronaut 5.1.5, Apollo Router 2.17.0, Kafka 4.2.1 and Postgres 17. Every result is reproduced by one script in the repository.

The system

Orders is a Spring Boot subgraph. Payments is a Micronaut subgraph. Each owns its database and publishes its slice of one GraphQL schema. The Apollo Router composes them into one endpoint, and Kafka carries order-placed and payment-captured between them.

What was measured

QuestionResult
Does the router fix N plus one?It sent one _entities call for 20 orders. The databases ran 20 and 20 selects until @BatchMapping and a DataLoader made it 1 and 1
A subgraph is downHTTP 200, the total present, payment: null, an error tagged with the service
The payment field made non-nullthe whole order comes back null
Kafka down, publish inside the requestrefused after about 60 seconds, the producer’s max.block.ms default, and rolled back
Kafka down, transactional outboxaccepted, survived the service being killed, paid after the restart
A crash before the offset commit2 payment rows without a unique key, 1 with it
A message that always failsSpring’s default retried 10 times; Micronaut’s deprecated default skipped two good records in the same poll
One team changes Order.id to String!composition refuses before anything is deployed

Spring and Micronaut, job by job

JobSpring BootMicronaut
Resolve a field@QueryMapping, @SchemaMappinga data fetcher in a factory
Batch a field@BatchMappinga DataLoader, registered per request
Resolve an entity@EntityMapping, idListFederation.transform, fetchEntities
Consume Kafka@KafkaListener(topics, groupId)@KafkaListener(groupId) with @Topic
Publish to KafkaKafkaTemplatea @KafkaClient interface the compiler implements
A listener throws10 attempts, then loggedNONE: deprecated, skips the rest of the poll

The full code, both configuration files key by key, the federation directives and the interview questions are in the free design sheet above.


Watch next

New videos land on Code with Sam - subscribe there if this was useful.

Get the interview pack

A free, practical pack for engineers preparing for senior backend interviews - the questions that actually get asked, and how to answer them like someone who has done the work.

New articles and videos when they land. No spam, and one click to leave.