How to override the default "tangosol-coherence-override.xml" packaged in coherence.jar to define Coherence Operational Configuration.

How to override the default "tangosol-coherence-override.xml" packaged in coherence.jar to define Coherence Operational Configuration.

book

Article ID: KB0091265

calendar_today

Updated On:

Products Versions
TIBCO BusinessEvents Enterprise Edition -
Not Applicable -

Description

Resolution:
1.       The value of the xml-override is specified as xml-override={name value} , name value pair where the value specified is the default value.


2.       The first tier override specified by the Tangosol-coherence.xml(coherence.jar) points to
         xml-override="{tangosol.coherence.override /tangosol-coherence-override-{mode}.xml}" .          
         The default value for "tangosol.coherence.override" is "/tangosol-coherence-override-prod.xml" which itself is contained inside the coherence.jar
         hence it is the first tier override.
        

3.       Now looking at the "tangosol-coherence-override-prod.xml"  it shows xml-override="/tangosol-coherence-override.xml" which means that the
        "tangosol-coherence-override-prod.xml" can be overridden once and that too only by a file named "tangosol-coherence-override-prod.xml"
         which should be in the classpath.
        

4.       Since our goal is to have multiple tiered overrides we have to set the value of "tangosol.coherence.override" to our first tier override
         while keeping in mind that we need the override values from the original Tangosol-coherence-override-prod.xml or change them as needed,
         these overrides are the ones which the user might want to keep same for           different environments. Therefore the first tier
         override will look like i.e

<?xml version='1.0'?>
<!DOCTYPE coherence PUBLIC "-//Oracle Corporation//DTD Oracle Coherence 3.3//EN"  "http://www.tangosol.com/dtd/coherence_3_3.dtd">
&ltcoherence xml-override="{be.coherence.override /be-coherence-override-{be.coherence.environment}.xml}">
    &ltcluster-config>
                &ltmulticast-listener>
                  &lttime-to-live system-property="tangosol.coherence.ttl"&gt4</time-to-live>
                  &ltjoin-timeout-milliseconds&gt30000</join-timeout-milliseconds>
                </multicast-listener>
                &ltpacket-publisher>
                  &ltpacket-delivery>
                    &lttimeout-milliseconds&gt60000</timeout-milliseconds>
                  </packet-delivery>
                </packet-publisher>
       </cluster-config>
              &ltlogging-config>
                &ltdestination system-property="tangosol.coherence.log"&gtc:/tmp</destination>
                &ltseverity-level system-property="tangosol.coherence.log.level"&gt9</severity-level>
                &ltmessage-format>&ltOVERRIDE 1>{date} {product} {version} <{level}> (thread={thread}, member={member}): {text}</message-format>
                &ltcharacter-limit system-property="tangosol.coherence.log.limit"&gt0</character-limit>
              </logging-config>
</coherence>


5.       The first override is done using the system property -Dtangosol.coherence.override=file:C:/tmp/tangosol-coherence-override.xml. The value of        
         the property can be a url.
        

6.       Notice the new override property "be.coherence.override" which has a default value of the file name as "/be-coherence-override-{be.coherence.environment}.xml"  therefore this           override looks for the file with the specified pattern in the classpath having the "be.coherence.environment" property determining the final name or specify it by overriding the
         "be.coherence.override" property.
        

7.       The second override is done by using the system property -Dbe.coherence.override=file:C:/tmp/override/be-coherence-override-test.xml


8.       The second override file be-coherence-override-test.xml  looks like this

<?xml version='1.0'?>
<!DOCTYPE coherence PUBLIC  "-//Oracle Corporation//DTD Oracle Coherence 3.3//EN" "http://www.tangosol.com/dtd/coherence_3_3.dtd">
&ltcoherence xml-override="{be.environment.test.override /be-environment-test-override-{be.environment.level}.xml}">
              &ltlogging-config>
                &ltdestination system-property="tangosol.coherence.log"&gtc:/tmp/override</destination>
                &ltseverity-level system-property="tangosol.coherence.log.level"&gt9</severity-level>
                &ltmessage-format>&ltOVERRIDE 2> {date} {product} {version} <{level}> (thread={thread}, member={member}): {text}</message-format>
                &ltcharacter-limit system-property="tangosol.coherence.log.limit"&gt0</character-limit>
              </logging-config>
</coherence>


9.    Further overriding can be done by extending the xml-override="{be.environment.test.override /be-environment-test-override-{be.environment.level}.xml}"  
      if needed.

Issue/Introduction

How to override the default "tangosol-coherence-override.xml" packaged in coherence.jar to define Coherence Operational Configuration.