We have a distributed system, in which two components: A and B, communicate by sending to each other some transport object, which is very large and complex.
Currently, the object is simply serialized into the wire by A and is read by B.
Now we are required to support a scenario in which B’s version is advanced while A’s version stays the same, which means B must have versioning capabilities to be able to process older versions of the communication object.
What are the common ways to do this?
(We use Java)
You can have different versions of the method – one that takes the old version and that
Auses.This method can also act as a translator into the new version (anti-corruption layer, if you will) and utilise a new method that all new clients should use.
Basically, your
Bshould be able to read both versions – internally the best way is to translate the old version to the new one and use that throughout the codebase ofB.