Sign in to track progress and bookmarks.
In microservices, the Contract is your only guarantee. If you change a field name in Service A, you might break Service B, C, and D instantly. You need a strategy to manage these changes safely.
Protobuf (Protocol Buffers) uses **Field Numbers** instead of names. You can rename a field in your C# code, but as long as the number stays the same (e.g., `string name = 1`), old services will still be able to read it. **Rule:** Never change a field number, and never delete a field (just mark it as `deprecated`).
Don't share a NuGet package containing your 'Domain' models. If you update the library, you force every service to redeploy at the same time—this is a 'Distributed Monolith.' Instead, share only the **Interface** or the **Protobuf file**. Let each service generate its own local models from the contract.
Q: "How do you handle 'Breaking' changes in a message contract?"
Architect Answer: "We use **Parallel Support**. We introduce the new field in V2, but keep sending data to V1 for 3 months. Once all consumers have migrated to V2, we deprecate and eventually delete V1. We use **Consumer Driven Contracts (Pact)** to automatically test if our changes will break any of our known consumers before we even merge the PR."
Quizzes linked to this course—pass to earn certificates.
On this page
1. Protobuf and Backward Compatibility 2. The Shared Library Antipattern 4. Interview Mastery