user1102718
user1102718

Reputation: 21

Coherence cache client accessing different caches on different clusters

We have 2 caches on different clusters. I want to access both of them via my extend client. I can access the first cache fine (any one), but then access to second one fails.

For example:

NamedCache cacheOne= CacheFactory.getCache("Cache-One");
NamedCache cacheTwo= CacheFactory.getCache("Cache-Two");

Second call will fail with :

Exception in thread "main" java.lang.IllegalArgumentException: No scheme for cache: "Cache-Two".

How can I access both the caches via the client? Client config is below:

*

<cache-config>
    <caching-scheme-mapping>
        <cache-mapping>
            <cache-name>Cache-One</cache-name>
            <scheme-name>Scheme-One</scheme-name>
        </cache-mapping>
        <cache-mapping>
            <cache-name>Cache-Two</cache-name>
            <scheme-name>Scheme-Two</scheme-name>
        </cache-mapping>
    </caching-scheme-mapping>
    <caching-schemes>
        <remote-cache-scheme>
            <scheme-name>Scheme-One</scheme-name>
            <service-name>TCPProxyCacheService</service-name>
            <initiator-config>
                <tcp-initiator>
                    <remote-addresses>
                        <socket-address>
                            <address>address of proxy one</address>
                            <port>2077</port>
                        </socket-address>
                    </remote-addresses>
                    <connect-timeout>300s</connect-timeout>
                </tcp-initiator>
                <outgoing-message-handler>
                    <request-timeout>300s</request-timeout>
                </outgoing-message-handler>
            </initiator-config>
        </remote-cache-scheme>
        <remote-cache-scheme> 
              <scheme-name>extend-castle</scheme-name> 
              <service-name>TCPProxyCacheService</service-name> 
              <initiator-config> 
                  <tcp-initiator> 
                     <remote-addresses> 
                               <socket-address> 
                                   <address>address of proxy two</address> 
                                  <port>20088</port> 
                               </socket-address> 
                      </remote-addresses> 
                      <connect-timeout>300s</connect-timeout> 
                   </tcp-initiator> 
                   <outgoing-message-handler> 
                      <request-timeout>300s</request-timeout> 
                   </outgoing-message-handler> 
              </initiator-config> 
        </remote-cache-scheme> 
    </caching-schemes>
</cache-config>

*

Upvotes: 2

Views: 5935

Answers (1)

ivan.cikic
ivan.cikic

Reputation: 1847

You have defined extend-castle scheme, where Scheme-Two scheme should have been defined. Either change scheme name in second remote-cache-scheme to Scheme-Two or change scheme name in second cache-mapping to extend-castle.

Upvotes: 1

Related Questions