- A new version of a contract that continues to support consumers designed to work with the old version of the contract is considered to be Backwards Compatible
- A contract that is designed to support unknown future consumers is considered to be Forwards Compatible
The correct definition of forwards compatible schemas as defined by David Orchard is this: "In schema terms, this is when a schema processor with an older schema can process and validate an instance that is valid against a newer schema". Backwards compatibility means that a new version of a receiver can be rolled out so it does not break existing senders. Forwards compatibility means that an older version of a receiver can consume newer messages and not break.
The confusion is caused when applying this message based definition to services, as service operations typically are both receivers and senders of messages. Most services should be designed to support both backwards and forwards compatible messages. But are the services themselves backwards or forwards compatible?
I define service compatibility this way:
- A new version of a service that continues to support consumers designed to work with the old version of the service is considered to be Backwards Compatible
- A service that is designed to support unknown future consumers is considered to be Forwards Compatible
As can be seen from the above figure, service backwards compatibility depends on the provider being able to validate the on-the-wire request XML against a newer schema version and the consumer being able to validate the response XML against an older schema version. The provider must be able to "ignore missing", while the consumer must be able to "ignore unknown".
As can be seen from the above figure, service forwards compatibility depends on the provider being able to validate the on-the-wire request XML against an older schema version and the consumer being able to validate the response XML against a newer schema version. The provider must be able to "ignore unknown", while the consumer must be able to "ignore missing".
So my advice when talking about compatibility is, always make it clear if you're focusing on the contracts (message) or the services (provider). You can even talk about compatibility from the consumer perspective if you're bold enough. But please: never, ever talk about the service provider as the message consumer...
To add to the complexity of forwards compatibility, there are three types of forward:
- Schema forward compatibilty
- Service forward compatibilty
- Routing forward compatibilty, a.k.a implicit versioning
- Implicit version routing: forwards compatible service routing, where a message automatically is routed to the newest compatible version
- Explicit version routing: traditional service routing, where each message is routed based on explicit version information in the message, typically a namespace
The implicit version routing policy is what our InfoQ article refers to as forwards compatible service versioning.
No comments:
Post a Comment