How do i connect to multiple Oracle Coherence cache's from a single application?
I have an application(written in CSharp) which currently connects to just one coherence cluster. This cluster is fed in data and when the application see's this in the cluster's cache it uses this to gain more information on what it was passed and then pass it back to the cluster which then stores this data in its second cache.
What i now want to do is have the application connect to a second coherence cluster and when it sees certain data in this cluster's cache it should once again get this data and find more information on it and then pass it back to this cluster which again stores this data in its secondary cache.
The problem i have is how do i configure my application to connect to two caches?
I've done some reading around this issue with conflicting answers. One suggestion is to change the classloader which is used at run-time, but i'm not sure how to do this, or if this is even the correct/best thing to do??
Any help 开发者_如何学Goor guidance on this issue would be much appreciated.
EDIT: After more digging i've found this explaination, does anyone have any ideas on whether or not this is the correct thing to do?
http://forums.oracle.com/forums/thread.jspa?threadID=1518273
After looking into this in more detail it would appear that the solution suggested in the above link is what is needed. You need to connect to each cluster as an extend client(as you can only be a member of one cluster without having to do some clever/messy stuff changing the class loader) and then add some extra config to specify another cluster and cache configuration. An example would be as follows:
<?xml version='1.0'?>
<cache-config>
<caching-scheme-mapping>
<cache-mapping>
<cache-name>Cache_for_C1</cache-name>
<scheme-name>extend-cache-C1</scheme-name>
</cache-mapping>
<cache-mapping>
<cache-name>Cache_for_C2</cache-name>
<scheme-name>extend-cache-C2</scheme-name>
</cache-mapping>
</caching-scheme-mapping>
<caching-schemes>
<remote-cache-scheme>
<scheme-name>extend-cache-C1</scheme-name>
<initiator-config>
<tcp-initiator>
<remote-addresses>
<socket-address>
<address>C1host</address>
<port>30200</port>
</socket-address>
</remote-addresses>
</tcp-initiator>
</initiator-config>
</remote-cache-scheme>
<remote-cache-scheme>
<scheme-name>extend-cache-C2</scheme-name>
<initiator-config>
<tcp-initiator>
<remote-addresses>
<socket-address>
<address>C2host</address>
<port>30200</port>
</socket-address>
</remote-addresses>
</tcp-initiator>
</initiator-config>
</remote-cache-scheme>
</caching-schemes>
</cache-config>
Hopefully this will help someone else like it helped me :)
精彩评论