1 Reply Latest reply on May 9, 2012 3:31 PM by P Fry-Oracle

    Is there way to merge c++ and java coherence config files

    870823
      Hi,
      I'm running two separate extended client with c++ and Java. Both has their own coherence cofiguration file.
      But now we are going to call c++ library via JNI. But when I tried to merge Java and C++ configuration file
      I got an issue with the serializer part.

      Java Config----------
      <?xml version="1.0"?>
      <!DOCTYPE cache-config SYSTEM "cache-config.dtd">

      <cache-config>
      <caching-scheme-mapping>
      <cache-mapping>
      <cache-name>User</cache-name>
      <scheme-name>pt-gce-remote-scheme</scheme-name>
      </cache-mapping>
      </caching-scheme-mapping>

      <caching-schemes>      
           <remote-cache-scheme>
      <scheme-name>pt-gce-remote-scheme</scheme-name>
      <service-name>ExtendTcpCacheService</service-name>
      <initiator-config>
      <tcp-initiator>
      <remote-addresses>
      <socket-address>
      <address system-property="tangosol.coherence.proxy.address">169.52.37.235</address>
      <port system-property="tangosol.coherence.proxy.port">9099</port>
      </socket-address>
      </remote-addresses>
      <connect-timeout>15s</connect-timeout>
      </tcp-initiator>
      <outgoing-message-handler>
      <request-timeout>60s</request-timeout>
      </outgoing-message-handler>
      <serializer>
                <class-name>com.tangosol.io.pof.ConfigurablePofContext</class-name>
                <init-params>
                <init-param>
                     <param-type>string</param-type>
                     <param-value>gce-custom-types-pof-config.xml</param-value>
                </init-param>
                </init-params>
           </serializer>
      </initiator-config>
      </remote-cache-scheme>
      </caching-schemes>
      </cache-config>

      --------------------

      C++ config

      <?xml version="1.0"?>
      <!DOCTYPE cache-config SYSTEM "cache-config.dtd">

      <cache-config>
      *<defaults>*
      *<serializer>pof</serializer>*
      *</defaults>*
      <caching-scheme-mapping>
      <cache-mapping>
      <cache-name>User</cache-name>
      <scheme-name>exposure-replicated-scheme</scheme-name>
      </cache-mapping>
      </caching-scheme-mapping>

      <caching-schemes>          
      <remote-cache-scheme>
      <scheme-name>gce-remote-scheme</scheme-name>
      <service-name>ExtendTcpCacheService</service-name>
      <initiator-config>
      <tcp-initiator>
      <remote-addresses>
      <socket-address>
      <address system-property="tangosol.coherence.proxy.address">169.52.37.235</address>
      <port system-property="tangosol.coherence.proxy.port">9099</port>
      </socket-address>
      </remote-addresses>
      <connect-timeout>15s</connect-timeout>
      </tcp-initiator>
      <outgoing-message-handler>
      <request-timeout>60s</request-timeout>
      </outgoing-message-handler>
      </initiator-config>
      </remote-cache-scheme>
      </caching-schemes>
      </cache-config>

      serialization is defined in the cpp files...

      When I remove the serializer from Java then C++ works but when I add serializer then C++ fails.

      Is there a way we can define the serializer for c++ like java through a config file.

      Thanks and regards,
      Sura

      Edited by: sura on May 7, 2012 4:07 AM
        • 1. Re: Is there way to merge c++ and java coherence config files
          P Fry-Oracle
          Hi Sura,

          As you have discovered, the Coherence C++ client library doesn't currently support the <defaults> element. However, For the example you have given, you can just remove the <defaults> element to get the desired behavior as the Coherence C++ client uses POF by default.

          If you want to specify a custom serializer in C++, you would need to define it in the scheme element where you want that custom serializer to be used.

          Hope this helps,

          Patrick