International Developer Logo Last Updated 19.11.08 at 11.48
 
TUTORIALS

Consumer-driven contracts: a service evolution pattern


Ian Robinson   11.09.06

Provider contracts have the following characteristics:

• Closed and complete: Provider contracts express a service’s business function capabilities in terms of the complete set of exportable elements available to consumers, and as such are closed and complete with respect to the functionality available to the system.

• Singular and authoritative: Provider contracts are singular and authoritative in their expression of the business functionality available to the system.

• Bounded stability and immutability: A provider contract is stable and immutable for a bounded period and/or locale. Provider contracts typically use some form of versioning to differentiate differently bounded instances of the contract.

Consumer contracts

If we decide to account for consumer expectations regarding the schemas we expose when evolving our service – and consider it worth our provider knowing about them – then we need to import those consumer expectations into the provider. The Schematron assertions in our example look very much like the kinds of tests that, if implemented by the provider, might help ensure the provider continues to meet its commitments to its clients.

By implementing these tests, the provider gains a better understanding of how it can evolve the structure of the messages it produces without breaking existing functionality in the service community. And where a proposed change would in fact break one or more consumers, the provider will have immediate insight into the issue and be better able to address it with the parties concerned, accommodating their requirements or providing incentives for them to change as business factors dictate.

In our example, we can say that the set of assertions generated by all consumers expresses the mandatory structure of the messages to be exchanged during the period in which the assertions remain valid for their parent applications. If the provider were possessed of this set of assertions, it would be able to ensure that every message it sends is valid for every consumer insofar as the set of assertions is valid and complete.

Generalising this structure, we can distinguish what we have already called the provider contract from the individual contractual obligations that obtain in instances of provider-consumer relationships, which we will now call consumer contracts. When a provider accepts and adopts the reasonable expectations expressed by a consumer, it enters into a consumer contract.

 

Consumer contracts have the following characteristics:

• Open and incomplete: Consumer contracts are open and incomplete with respect to the business functionality available to the system. They express a subset of the system’s business function capabilities in terms of the consumer’s expectations of the provider contract.

• Multiple and non-authoritative: Consumer contracts are multiple in proportion to the number of consumers of a service, and each is non-authoritative with regard to the total set of contractual obligations placed on the provider. The non-authoritative nature of the relationship extending from consumer to provider is one of the key features that distinguish a service-oriented architecture from a distributed application architecture. Service consumers must recognise that their peers in a service community are liable to consume the provider in ways quite different from their own. Peers may evolve at different rates and demand changes of the provider that potentially disturb the dependencies and expectations residing in other parts of the system. A consumer cannot anticipate how or when a peer will disturb the provider contract; a client in a distributed application has no such concerns.

• Bounded stability and immutability Like provider contracts, consumer contracts are valid for a particular period of time and/or location.

 

Consumer-driven contracts

Consumer contracts allow us to reflect on the business value being exploited at any point in a provider’s lifetime. By expressing and asserting expectations of a provider contract, consumer contracts effectively define which parts of that provider contract currently support the business value realised by the system and which do not. This leads us to suggest that service communities might benefit from being specified in the first instance in terms of consumer contracts. In this view, provider contracts emerge to meet consumer expectations and demands. To reflect the derived nature of this new contractual arrangement, we call such provider contracts consumer-driven contracts or derived contracts.

The derivative nature of consumer-driven provider contracts adds a heteronymous aspect to the relationship between service provider and consumer. That is, providers are subject to an obligation that originates from outside their boundaries. This in no way impacts on the fundamentally autonomous nature of their implementations; it simply makes explicit the fact that services depend for success on their being consumed.

 


Consumer-driven contracts have the following characteristics:

• Closed and complete: A consumer-driven contract is closed and complete with respect to the entire set of functionality demanded of it by its existing consumers. The contract represents the mandatory set of exportable elements required to support consumer expectations during the period in which those expectations remain valid for their parent applications.

• Singular and non-authoritative: Provider contracts are singular in their expression of the business functionality available to the system, but non-authoritative because derived from the union of existing consumer expectations

• Bounded stability and immutability: A consumer-driven contract is stable and immutable in respect of a particular set of consumer contracts. That is to say, we can determine the validity of a consumer-driven contract according to a specified set of consumer contracts, effectively bounding the forwards- and backwards-compatible nature of the contract in time and space. The compatibility of a contract remains stable and immutable for a particular set of consumer contracts and expectations, but is subject to change as expectations come and go.




   Previous Page  ... 11 12 13 Next Page   

HAVE YOUR SAY
This article is rated  Rate this article