Versioning the Contract ( for services)
Messaging is something that is growing in popularity and usage. SOA is becoming predominant. So something important to think about would be contract versioning. From the very first time a contract is born till it matures and gets implemented in a stable solution as a message template, it changes. It changes in syntax, semantics and requirement expectations.
For example, two companies exchanging data. Now both these companies have thier own solutions which interpret data in their own ways. So how do we make sure that what one company reads is how the other company wants it to read the data as?
So solve this issue we use contracts, I wont bother going into the details of contract, but I thought something that should be highlighted was contract versioning. It helps developers and architects to work efficiently while the contract grows and changes.
Before the versioning info, I just wanna mention some agreements of a contract facilitating messaging between these two companies.
- Format of the Data
- Order of Data
- Valid Values and Content
- Semantics of processing the data (how application understands the data)
- Message Combination ( Is message attached with an error info? Does it require a response?)
Now for the versioning, some of the ways I can think of would be using the root element tag name or root element attribute as shown below(note: There are more ways of achieving this using DOCTYPE, namespaces, etc):
<MyCoolContract_v1_1> ... ... ... </MyCoolContract_v1_1>
<MyCoolContract_v1_2> ... ... ... ... ... ... ... ... ... </MyCoolContract_v1_2> (using version in the root element tag name)
<MyCoolContract version="1.1"> ... ... ... </MyCoolContract>
<MyCoolContract version="1.2"> ... ... ... ... ... ... ... ... ... </MyCoolContract> (using version in the root element attribute)
Also since we are taking about request messaging versions, lets also target the request messages that warrants a response message.
<MyCoolContract version="1.1" responseVersion="1.4> ... ... ... </MyCoolContract>
<MyCoolContract version="1.2" responseVersion="2.1"> ... ... ... ... ... ... ... ... ... </MyCoolContract>
Looks good? ;)