liveBook · Manning

Facade-style api

As explained in Microservices Patterns, Second Edition

An API that exposes a limited set of operations while hiding the implementation details of the component behind it.

A facade-style API exposes intended operations while hiding a domain module’s entities, repositories, and other implementation details. This reduces design-time coupling between modules and makes clients easier to test. section 6.2.3

Credit operations between domain modules

An Order Domain Module can call a ConsumerService interface to reserve or release credit instead of using the Consumer entity and ConsumerRepository directly. The Order module can then mock that service in tests. section 6.2.3

Prefer collaboration through APIs, but weigh modularity against implementation effort and query efficiency: a cross-module SQL query may be a pragmatic exception. section 6.2.3

Figure 6.12 The ConsumerService facade encapsulates the implementation details of the Consumer Domain Module and reduces design-time coupling. Moreover, an Order Domain Module can easily mock the ConsumerService facade.
modular monolith module facade

Shows how the ConsumerService facade hides implementation details and reduces coupling. section 6.2.3

How Microservices Patterns, Second Edition covers it

How deep it goes
Defines a service interface, DTO use, test mocking, and trade-offs with direct database access.
Examples
Uses an Order module calling ConsumerService to reserve or release credit and mock the service in tests.
What it assumes
Assumes domain modules that need to invoke operations across module boundaries.
What you can do after
Apply it by exposing module operations through a service interface that clients can mock.
How it connects
Connects domain modules with service interfaces, data transfer objects, entities, repositories, and database schemas.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Microservices Patterns, Second Edition. The section links point to the parts of the book it draws on.