1 2 Previous Next 19 Replies Latest reply on Dec 14, 2012 12:59 AM by Yong Hao Gao

    Solving the backward compatibility issue -- working with clients of old versions

    Yong Hao Gao Master

      The issue is that since 2.3 we have made changes to DiscoveryGroupConfiguration to support JGroups. This causes a serialization problem when a version 2.2 JMS client need to get a ConnectionFactory via JNDI from the new 2.3 server. The reason is that we have introduced some new class (BroadcastEndpointFactoryConfiguration) into DiscoveryGroupConfiguration. When a new CF is marshalled to version 2.2 client, it has problem de-serializing it because this new class cannot be found in its jars.


      To solve the problem we have to deliver a compatible DiscoveryGroupConfiguration object to 2.2 clients. To achieve this we


      1. add a new attribute named 'client-version' to the Connection Factory configuration. The value of the client version is a version string indicating which version of clients a connection factory is going to support. Valid values are '2.2' and '2.3'. Default is '2.3'. So if working with 2.2 clients, one should configure the CF like the following example:


         <connection-factory name="NettyConnectionFactory">


            <discovery-group-ref discovery-group-name="dg-group1"/>


               <entry name="/ConnectionFactory"/>





      2. Rename DiscoveryGroupConfigutration class to DisoveryGroupConfigurationV2_3 and make the DiscoveryGroupConfiguration class to be a copy of version 2.2's. Then add a writeReplace() method to control the serialization of DiscoveryGroupConfigurationV2_3. If the CF is serialized for a 2.2 client, we use the writeReplace method to actually serialize a version 2.2 DiscoveryGroupConfiguration object. If it is for a 2.3 client, the DiscoveryGroupConfigurationV2_3 is serialized instead.


      3. A minor issue is in version 2.2 ServerLocator the initialConnectors can be null but in 2.3 it is always not null. This can cause a 2.2 client to malfunction. We have to add a writeObject() method to the ServerLocator to covert an empty initialConnectors array to null before it is seralized for 2.2 client.


      4. In case of AS7 integration, we add the same attribute to jms connection factory and pooled conection factory configurations. It will eventually be passed into hornetq core and the rest are all the same with standalone hornetq.

        1 2 Previous Next