Sobes.tech
Senior

How do you coordinate with neighboring teams on contracts — protobuf, event contracts, what is the difference?

sobes.tech AI

Answer from AI

When coordinating with neighboring teams on contracts, it is important to understand the differences between protobuf and event contracts:

  • Protobuf (Protocol Buffers) — is a binary data serialization format with a clearly defined schema. A contract in protobuf is a definition of message structures (e.g., API requests and responses). It is strictly typed and allows for version compatibility guarantees.

  • Event contracts — are agreements on the format and content of events published and consumed within the system (e.g., via Kafka). They can be described using protobuf, JSON Schema, or other formats. The main point is to agree on the event structure, its semantics, and behavior when changes occur.

In practice:

  • For RPC or API, protobuf contracts are often used to strictly define input and output data.
  • For event-driven systems — event contracts describe events, their fields, and evolution rules.

Agreements include:

  • Versioning of contracts
  • Backward compatibility
  • Update and deployment processes
  • Responsibility for support and testing

Thus, protobuf is a technology for describing data structures, while event contracts are a broader concept that includes agreements on events and their processing.