Customer onboarding pipeline
A Kafka pipeline that persists inbound customer events, maps them to a CustomerDTO with MapStruct, and creates the customer profile.
A Kafka-driven pipeline that turns inbound customer events into created customer profiles.
The flow
- A customer event arrives on a Kafka topic.
- It is written to the event repository first, before anything is done with it.
- A processing step picks it up and reads the payload.
- The payload is mapped to a
CustomerDTO, with MapStruct generating the mapping code. - The customer is created from the DTO and lands in the profile repository, where it becomes visible downstream.
Why persist the event before processing it
Storing the raw event first means the pipeline owns a durable record of what arrived, independent of whether processing succeeded. If a mapping throws or a downstream service is down, the event is still there to be reprocessed. Process first and it exists only in memory and in Kafka's retention window.
Why MapStruct rather than hand-written mapping
MapStruct generates the mapping at compile time: no reflection at runtime, and a field that stops matching becomes a build failure rather than a silently null column found in production.
Still to fill in — duplicate events, failure handling, ordering and partition key, rough volume. Those are the follow-up questions.