Using Same Profile but Different Configuration for Different Server Groups

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

Internal

Overview

The fact that we are able to specify different properties (or same properties with different values) for different server groups allows us to use a single profile with multiple server groups, if the differences in configuration between server groups can be expressed as values of system properties. The following example shows how to declare different MDB container pool sizes for servers belonging to two different groups.

Procedure

Declare a system property that will carry the value of the MDB pool size. This system property will have different values per server group. It is also possible that the system property may not be declared for specific server groups, and in this case, the default configuration value, as shown below, will be used.

<server-groups>
    <server-group name="A" profile="common">
        <system-properties>
            <property name="our.mdb.max.pool.size" value="1"/>
        </system-properties>
        ...
    </server-group>
    <server-group name="B" profile="common">
        <system-properties>
            <property name="our.mdb.max.pool.size" value="10"/>
        </system-properties>
        ...
    </server-group>
    <server-group name="C" profile="common">
        <!--
            No property declaration here, which means the default value will be used.
        -->
        ...
    </server-group>
</server-groups>

Use the system property name, and a default value for the case the system property is missing.

<profiles>
    <profile name="common">
        ...
        <subsystem xmlns="urn:jboss:domain:ejb3:...">
            ...
            <pools>
                <bean-instance-pools>
                    <strict-max-pool name="mdb-strict-max-pool" 
                                      max-pool-size="${our.mdb.max.pool.size:20}" .../>
                </bean-instance-pools>
            </pools>
            ...
        </subsystem>
    </profile>