Open Host Service

OHS

Escrito por Darjus Kazakevic · revisado el

One public API for every consumer, instead of one integration each.

In an online shop, Shipping needs orders from Sales. So do Billing, Support and the analytics team. If Sales builds a custom endpoint for each, by the fifth consumer the Sales team spends its time on integrations, and no endpoint can change without breaking someone.

An open host service (OHS) is one public API, the same for every consumer, with written compatibility rules. Consumers adapt to it, not the other way round. It usually sends a published language: the documented format of its data.

En esencia — Offer one documented API that any context can use, with written rules about what may change, instead of building a custom integration per consumer.

Cuándo recurrir a él

Recurre a él cuando

  • A third consumer is about to get its own custom integration
  • The upstream team spends more time on integrations than features
  • Consumers belong to teams you cannot change in lockstep

Reconsidéralo cuando

  • One consumer you can change in the same pull request
  • Upstream cannot support old versions for a stated time
  • Two teams in a partnership that change together anyway

Conceptos clave

One protocol for all
A single API or event stream that every consumer uses. It can be REST, gRPC or events on Kafka. The pattern is that there is one, not which technology it uses.
Compatibility rules
Written rules that say what may change without notice, what needs a new version, and how long an old version lives. These rules turn an endpoint into a public interface.
Side-by-side versions
A breaking change ships as a new version next to the old one. Consumers move in their own time, inside the stated support window.

Reglas de diseño

Write the compatibility rules down
State what may change without notice, what needs a new version, and how long an old version lives. Without these rules it is just an endpoint several teams happen to call.
Never add a consumer-specific endpoint
Consumers adapt to the protocol, not the other way round. The first endpoint shaped for one client reopens the custom-integration path the pattern exists to close.
Retire old versions by traffic and date
Ship a breaking change as /v2 next to /v1, announce an end date, and watch v1 traffic. Remove v1 when its traffic is near zero or the date has passed.

Errores habituales

  • No written rules, so an “additive” change breaks a strict consumer
  • A consumer-specific endpoint added “just this once”
  • Exposing the internal model directly instead of a published language
  • Versions that are never retired, so the team supports five forever