> > Does the order of registering classes work?
This was meant to be "Does the order of registering classes matter?"
and I got my answer as yes it does.
By long term and large scale projects i mean projects which would
evolve, probably get more classes
maybe some of the old ones get re-factored into better abstractions, I
am sure this is pretty common
in enterprise systems where multiple teams collaborate on huge
projects and eventually refactor each other's
code to make it better or add features.
Though i am not doing long term persistence, I am using the serialized
versions(these have a limit of 1KB) of the objects to be put as
payloads of a message in a queue which would be acted upon by workers.
Now as it is the case that refactoring invalidates
the de-serializability of older messages(as it is the case with the
stock serializers) each time a newer version of the
system is deployed the team would have to either do a migration of the
serialized objects to the new format and re-insert
them to the queue, or stop newer tasks to be added, or have the system
manage older and newer versions.
Also, as per the earlier response I can get around by writing a custom
serializer to manage versioning but then the fact that I need to make
sure that the developer "ONLY" appends to the list is somewhat of a
magic bean when it comes to the long term usage.
The case in point is that in case 2 months from now if a different
team decides to add some new classes and adds stuff to the register
methods list in random order (not necessarily appends) this would
cause the system to become unusable and would become insanely
difficult to debug.
I think for my particular use case a schema based approach such as
avro or protobuf/protostuff is better especially because the results
are a but more reproducible and atleast avro addresses these problems
directly.
I do not mind writing some extra code to make kryo work but why do it!
Kryo is a good library but i don't really think its suitable in such a
scenario.
Unless someone can give me a good explanation about some features that
address these concerns or if they have had success in implementing a
solution that dealt with the above mentioned challenges I would love
to hear their suggestions.