advanced 2 min answer

A downstream team needs to react to order changes. The order service can publish events, or they can consume CDC from its database. Which, and why?

cdceventscouplingintegration
Show the full answer Hide the answer

The recommendation: published events, with CDC as the mechanism if needed

The distinction that matters is what the consumer becomes coupled to.

CDC consumed directly couples the downstream team to the order service's internal schema. A column rename, a normalisation change, a table split — ordinary refactors the order team is entitled to make — break the consumer. The order team never agreed to a contract and will not know they broke one.

Published domain events couple the consumer to a deliberate contract: OrderPlaced, OrderCancelled, OrderShipped, with versioned schemas and a compatibility policy. The order service can restructure its tables freely as long as it keeps emitting the same events.

Row deltas also carry the wrong semantics. A status column changing from 3 to 4 does not tell the consumer that an order was cancelled by the customer rather than by fraud review — and the consumer ends up reimplementing the producer's business logic from column values, which is both wrong and brittle.

Where CDC belongs

As an implementation detail on the producer's side. The order service writes an event to an outbox table in the same transaction as the business change; CDC tails the log and publishes it. That gives atomicity between state and event with no dual write, and no load on the source — while the published contract remains a business event.

CDC consumed directly is legitimate in two cases: replication into an analytical store, where the warehouse team accepts coupling to the source schema and there is a translation layer; and integrating with a system that cannot be changed, where there is no possibility of it publishing events. In the second case, put an anti-corruption layer immediately downstream so the coupling stops at one component.

What I would ask before deciding

Does the order service already have an outbox? If not, the work is on the producer's side and needs their agreement, which is the real conversation. If they cannot take it on now, CDC plus a translation service owned by the producer is a reasonable interim — the key being that the translation is owned by the team that owns the schema.

What a strong answer adds

Naming the organisational failure this usually hides: the downstream team chose CDC because asking the producer for events would have taken a quarter. That is a delivery-pressure decision creating a permanent coupling, and it should at least be recorded as one — a data contract or an ADR — rather than becoming an undocumented dependency discovered during the producer's next refactor.