Coherence*Extend connection exception handling

171 views Asked by At

I have cache serve use Coherence CE 14.1.1 with extends client support

client use hibernate 5.2.17 with L2 coherence 14.1.1 cache

  • How to handle connection failure between client and cache server so that when server down the client continue save normal on DB without crashing. As for now when cache server is down or there is some connection issue the client crashed and all CRUD operation fail.
  • Second is there is a way to have multiple remote proxy options with priority, as if first listed proxy fail the App client will try to connect to another listed proxy in configuration file. If all fails then the App client L2 cache should simply ignore caching.

below configuration files hibernate-second-level-cache-config.xml

<?xml version="1.0"?>

<!--
  Copyright (c) 2020, Oracle and/or its affiliates.
  Licensed under the Universal Permissive License v 1.0 as shown at
  http://oss.oracle.com/licenses/upl.
-->

<cache-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xmlns="http://xmlns.oracle.com/coherence/coherence-cache-config"
              xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-cache-config coherence-cache-config.xsd">

    <caching-scheme-mapping>
        <cache-mapping>
            <cache-name>org.hibernate.cache.internal.StandardQueryCache</cache-name>
            <scheme-name>remote</scheme-name>
        </cache-mapping>

        <cache-mapping>
            <cache-name>query.*</cache-name>
            <scheme-name>remote</scheme-name>
        </cache-mapping>

        <cache-mapping>
            <cache-name>org.hibernate.cache.spi.UpdateTimestampsCache</cache-name>
            <scheme-name>remote</scheme-name>
        </cache-mapping>

        <cache-mapping>
            <cache-name>*</cache-name>
            <scheme-name>remote</scheme-name>
        </cache-mapping>
    </caching-scheme-mapping>

    <caching-schemes>
        <remote-cache-scheme>
            <scheme-name>remote</scheme-name>
            <service-name>ExtendTcpCacheService</service-name>
            <initiator-config>
                <tcp-initiator>
                    <name-service-addresses>
                        <socket-address>
                            <address>127.0.0.1</address>
                            <port>7574</port>
                        </socket-address>
                    </name-service-addresses>
                </tcp-initiator>
                <outgoing-message-handler>
                    <request-timeout>5s</request-timeout>
                </outgoing-message-handler>
            </initiator-config>
        </remote-cache-scheme>
    </caching-schemes>
</cache-config>
1

There are 1 answers

0
ahmed hamza On

answer for second question is:

on client side App, edit the cache-config file by add additional tag to , while make sure that on all remote server the proxy name is matching exactly the client service-name

<remote-cache-scheme>

  <scheme-name>remote</scheme-name>

  <service-name>ExtendTcpCacheService</service-name>

  <initiator-config>

    <tcp-initiator>

      <remote-addresses>

        <socket-address id="1">

          <address>remote-IP-1</address>

          <port>7575</port>

        </socket-address>

        <socket-address id="2">

          <address>remote-IP-2</address>

          <port>7575</port>

        </socket-address>

      </remote-addresses>

    </tcp-initiator>

    <outgoing-message-handler>

      <request-timeout>5s</request-timeout>

    </outgoing-message-handler>

  </initiator-config>

</remote-cache-scheme>