ADR-BW-004: Integrate request-response operations through owned HTTP and gRPC contracts
Use service-owned HTTP APIs and defined Protocol Buffer interfaces rather than internal handlers or database access.
| Field | Value |
|---|---|
| Status | Proposed |
| Date | 2026-11-07 |
| Owners | Architecture Enabling TeamTeamArchitecture Enabling TeamEnabling team facilitating BookWorm's architecture governance, ADRs, arc42 documentation, engineering standards, testing...Open docs |
| Affected Resources | BookWormDomainv1.0.0BookWormCore e-commerce domain for the BookWorm online bookstore, coordinating catalog discovery, customer baskets, order fulfil...Ownerarchitecture-enabling-teamDiagramRepositoryOpen docs |
| Related ADRs | ADR-BW-005: Use Kafka for configured asynchronous integrationDecision Recordv1.0.0ADR-BW-005: Use Kafka for configured asynchronous integrationRetain the shared Wolverine Kafka integration for asynchronous cross-capability messages where a broker is configured.Ownerplatform-engineering-teamOpen docs, ADR-BW-017: Gate independent evolution on contract compatibilityDecision Recordv1.0.0ADR-BW-017: Gate independent evolution on contract compatibilityPrefer compatible contract changes and coordinate breaking migrations using consumer-impact review and the existing sche...Ownerarchitecture-enabling-teamOpen docs, ADR-004: Use domain APIs as MCP data sourcesDecision Recordv1.0.0ADR-004: Use domain APIs as MCP data sourcesMCP data access goes through Catalog and Rating service APIs instead of reading their databases directly.Ownerai-capabilities-teamOpen docs |
Context & Problem Statement
Synchronous interactions—such as checkout price validation between Order APIServicev1.0.0Order APIAuthenticated Ordering service for Buyer profiles and the Order lifecycle, creating Orders from baskets, snapshotting pr...PublishesGetBasketGrpc, GetBookGrpc +5SubscribesCreateOrder, CompleteOrder +11APIsOpenAPI, AsyncAPI, Carrier Service LevelsOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs and Catalog APIServicev1.0.0Catalog APIInternal HTTP and gRPC service for Catalog product management, hybrid discovery, and authoritative book metadata. PublishesBookUpdatedRatingFailedIntegrationEventSubscribesCreatePublisher, UpdatePublisher +24APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs, basket reads, and MCP ServerServicev1.0.0MCP ServerInternal stateless Streamable HTTP MCP service that exposes read-only Catalog lookup tools and reusable AI prompts. PublishesListBooksGrpc, GetBookDetailsGrpc +2Ownerai-capabilities-teamDiagramRepositoryOpen docs tool calls—require immediate responses. Reading another service’s database or invoking internal handlers directly couples callers to private implementation details and bypasses authorization.
Decision Drivers
- Encapsulation: Separate public contracts from private persistence and internal handlers.
- Protocol fit: Serve external clients via RESTful HTTP and internal service-to-service queries via typed gRPC.
- Synchronous restraint: Reserve request-response calls for operations that genuinely require an immediate answer.
Options Considered
| Option | Pros | Cons |
|---|---|---|
| Owned HTTP APIs + typed internal gRPC contracts | Strong encapsulation, authorization at boundaries, and typed internal calls | Requires maintaining both OpenAPI and Protocol Buffer definitions |
| Direct cross-service database reads | Zero network hop | Exposes private schemas and bypasses domain validation and auth |
| HTTP/JSON only for all calls | Uniform tooling everywhere | Higher serialization overhead and weaker schema typing for internal calls |
| gRPC only for all calls | Single typed contract format | Browsers and external clients still require an HTTP/REST gateway |
Decision & Consequences
Chosen Option: Integrate synchronous operations exclusively through service-owned HTTP APIs (for frontend and external consumers) and typed gRPC contracts (for internal service-to-service reads such as Catalog APIServicev1.0.0Catalog APIInternal HTTP and gRPC service for Catalog product management, hybrid discovery, and authoritative book metadata. PublishesBookUpdatedRatingFailedIntegrationEventSubscribesCreatePublisher, UpdatePublisher +24APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs and Basket APIServicev1.0.0Basket APIInternal HTTP and gRPC service for managing customer-scoped shopping baskets, Catalog price enrichment, and post-checkou...PublishesGetBookGrpc, GetBooksGrpc +2SubscribesCreateBasket, UpdateBasket +4APIsOpenAPI, AsyncAPIOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs). Work that does not require an immediate response must use asynchronous messaging instead.
- Positive: Callers depend only on versioned public contracts; owning services enforce all validation and authorization.
- Negative: Synchronous calls remain sensitive to downstream availability and require explicit timeouts and fallbacks.
Compliance Criteria
- Services must never query another service’s database, cache, or internal mediator handlers.
- External and frontend endpoints must expose documented HTTP/OpenAPI contracts; internal synchronous reads should prefer typed gRPC contracts.
- Long-running or post-commit side effects must be offloaded to asynchronous events rather than blocking HTTP/gRPC calls.