1 Reply Latest reply on Jul 31, 2003 9:25 AM by frito

    ObjectMessage & (de)serialization problem

      I would like to know if anybody knows a best practice or a solution to a really annoying issue we have.

      We have several queues containing ObjectMessage. messages are put in thoses queues during the day and clients connects remotely to get their messages.

      The problem is that we have to upgrade the object in there (let's say it's a javabean -> Add an attribute). When we deploy we upgrade also the client and they cannot retrieve old messages (the one without this new attribute).

      Anybody had the same issue?

        • 1. Re: ObjectMessage & (de)serialization problem
          frito

          The objects the clients and server share are part of your interface between client and server. Such an interface should be designed very carefully and shouldn't incompatibly change (at least not very often).
          There is not really a smart way doing this. Every approach (if practical) has its downside. Some ideas:
          - design carefully and don't change your interfaces (best practice *G*)
          - use some kind of generic interface, e.g. don't store your attributes in a type safe way but use lists or maps and access them generic (getAttributeByName or something like this)
          - magage the objects serial version id, let your newer objects handle "older" versions by controlling the readObject() and writeObject() methods and ignoring/defaulting unknown attributes
          - block the client activity while updating the server, before the clients start over working, all (persistent) messages must have been consumed, converted and resent by some kind of "update service"
          - combine all above to something even more complex and confusing

          Oh, don't forget: keep it simple... *G*

          Greetings,
          Frito