Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle coherence with weblogic server?

Hi i am new to oracle coherence,

Question 1 : my scenario is, i have to implement the oracle coherence replicated cache in my webapplication.(with weblogic server).the coherence should be the part of the weblogic server means when i start the weblogic server the coherence should start (both should run in the single JVM).please help me how to do it ?

Question 2 : whether i need a database to maintain the records or oracle coherence it self maintain in file system ? if yes means how and what will happen for the cached data when i shutdown the server?

like image 708
Saiyansharwan Avatar asked Oct 23 '22 18:10

Saiyansharwan


2 Answers

Q1:

I would describe it in couple of steps:

  1. Place coherence.jar in the classpath. Depending on specific case it can be WLS classpath or application's classpath. Unless you want to share coherence node between many applications it is often a better idea to put it to application's classpath. It also has other advantages like easier maintenance.
  2. Prepare your own cache configuration for the replicated topology. You can skip this step if you want to use coherence default cache configuration coherence-cache-config.xml which includes replicated topology, but keep in mind that your cache name must start with repl- and this is in general not recommended for production. Otherwise put the following to your custom-cache-config.xml file and add it to your application's classpath.

    <?xml version="1.0"?>
    
    <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>my-repl-cache</cache-name>
             <scheme-name>replicated</scheme-name>
          </cache-mapping>
       </caching-scheme-mapping>
    
       <caching-schemes>
          <replicated-scheme>
             <scheme-name>replicated</scheme-name>
             <backing-map-scheme>
                <local-scheme/>
             </backing-map-scheme>
             <autostart>true</autostart>
          </replicated-scheme>
       </caching-schemes>
    </cache-config>
    
  3. Create a ContextListener for your application and place the following code into contextInitialized method:

    // join existing cluster or form a new one
    CacheFactory.ensureCluster();
    
  4. Start your WLS with the following option:

    -Dtangosol.coherence.cacheconfig=custom-cache-config.xml
    
  5. Deploy and start your application (possibly on many servers)

Q2:

In general coherence is in memory solution and doesn't persist data by default. If you need to manage data in persistent store you can look into CacheStore interface. This is described here in the documentation.

Keep in mind that often you have more than one coherence node in the cluster so you will not lose your data when you shutdown one of them because data is always stored also in other JVM(s). When you restart your node it will join the cluster and your data will be there.

like image 160
Mihau Avatar answered Jan 02 '23 21:01

Mihau


Starting with WebLogic 12.1.2, there is excellent Coherence integration via the "Coherence Containers" functionality of WebLogic, in addition to the ActiveCache feature of WebLogic. Here is a URL for the container feature: http://docs.oracle.com/middleware/1212/wls/WLCOH/deploy-wls-coherence.htm

For the sake of full disclosure, I work at Oracle. The opinions and views expressed in this post are my own, and do not necessarily reflect the opinions or views of my employer.

like image 45
cpurdy Avatar answered Jan 02 '23 19:01

cpurdy