Coherence缓存客户端访问不同集群上的不同缓存

发布于 2024-12-21 10:08:45 字数 2914 浏览 2 评论 0原文

我们在不同的集群上有 2 个缓存。我想通过我的扩展客户端访问它们。 我可以很好地访问第一个缓存(任何一个),但访问第二个缓存失败。

例如:

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

第二次调用将失败并显示:

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

如何通过客户端访问这两个缓存?客户端配置如下

**

<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>

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>

*

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

め可乐爱微笑 2024-12-28 10:08:45

您已经定义了 extend-castle 方案,其中应该定义了 Scheme-Two 方案。将第二个 remote-cache-scheme 中的方案名称更改为 Scheme-Two 或将第二个 cache-mapping 中的方案名称更改为 extend -城堡

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文