Video in progress
You have to make a breaking change in an internal service API that has 25 consumers. How do you plan and deploy it?
I do not ship a breaking change in one move: I add the new version side by side with the old one, watch the consumers through metrics, give them a migration deadline, and remove the old version only when traffic to it has dropped to zero.
📖 Answer
25 consumers means 25 teams, each with its own release schedule. "We all deploy together on Tuesday" does not work.
The sequence:
- Is it really breaking? Many changes can be made additive: add a new field and leave the old one deprecated. That is the cheapest way.
- Side-by-side versions:
/v2/orders, or a new gRPC method, or a new Kafka topic. Internally, the old endpoint is wired to the new logic through an adapter, so you do not have two code bases. - Know who uses what: a consumer identifier on every request (service account, header), and a
consumerlabel in the metrics. Without it, there is no answer to "who is still on v1?" - Contract tests: with consumer-driven contracts such as Pact, consumers publish their expectations and the provider's CI checks them. A breaking change shows up in the PR.
- Deprecation: the
DeprecationandSunsetHTTP headers, an announcement, a deadline (3 months, say), and a monthly list of who is left. - Removal: once traffic is zero, the endpoint first returns 410 for a week, then the code is deleted.
Kafka has an extra subtlety: old messages stay in the topic and consumers may re-read them. If you turn on a compatibility mode (BACKWARD/FULL) in Schema Registry, a breaking schema simply will not register.
The hardest part is not technical: it is the last 2-3 consumers. Their priorities are elsewhere. This is where an agreement at the management level works, and if needed, opening the PR on their behalf.
Sign up to mark studied questions and save your progress.