Components of the Contract

• The data formats define in which format information is expected by the other microservices and how they are passed over to a microservice.

• The interface determines which operations are available.

• Procedures or protocols define which operations can be performed in which sequence with which results.

• Finally, there is meta information associated with the calls that can comprise for example a user authentication.

• In addition, there can be certain nonfunctional aspects like the latency time or a certain throughput.

Contracts

There are different contracts between the consumers and the provider of a service:

• The Provider Contract comprises everything the service provider provides. There is one such contract per service provider. It completely defines the entire service. It can, for instance, change with the version of the service (see section 8.6).

• The Consumer Contract comprises all functionalities that a service user really utilizes. There are several such contracts per service—at least one with each user. The contract comprises only the parts of the service that the user really employs. It can change through modifications to the service consumer.

• The Consumer-Driven Contract (CDC) comprises all user contracts. Therefore, it contains all functionalities that any service consumer utilizes. There is only one such contract per service. Since it depends on the user contracts, it can change when the service consumers add new calls to the service provider or when there are new requirements for the calls.

Figure 10.8 summarizes the differences.

The Consumer-Driven Contract makes clear which components of the provider contracts are really used. This also clarifies where the microservice can still change its interface and which components of the microservice are not used.