Search code examples
jmsjboss6.xsolaceresource-adapter

Do multiple resource adapters of different Message providers in Jboss EAP 6.4 share the default bean-instance-pool?


We are using JBoss EAP6.4. In our project we are using two MOMs: 1) Websphere MQ 2) Solace MQ This is how the resource adapters of two above MOMs our defined in our standalone.xml

<?xml version='1.0' encoding='UTF-8'?>
<server xmlns="urn:jboss:domain:1.7">
<profile>       

    <subsystem xmlns="urn:jboss:domain:ejb3:1.5">

        <mdb>
            <resource-adapter-ref resource-adapter-name="wmq.jmsra.rar"/>
            <bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
        </mdb>
        <pools>
            <bean-instance-pools>
                <strict-max-pool name="mdb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
            </bean-instance-pools>
        </pools>

    </subsystem>


    <subsystem xmlns="urn:jboss:domain:resource-adapters:1.1">
        <resource-adapters>

            <resource-adapter id="wmq.jmsra.rar">
                <archive>wmq.jmsra.rar</archive>
                <transaction-support>NoTransaction</transaction-support>
                <config-property name="traceLevel">3</config-property>
                <config-property name="traceEnabled">true</config-property>
                <connection-definitions>
                    <connection-definition class-name="com.ibm.mq.connector.outbound.ManagedQueueConnectionFactoryImpl" jndi-name="java:jboss/jms/myJMSQueueConnectionFactory" enabled="true" use-java-context="true" pool-name="jms/myJMSQueueConnectionFactoryPool">
                        <config-property name="channel">${mq.channel}</config-property>
                        <config-property name="hostName">${mq.host}</config-property>
                        <config-property name="transportType">${mq.transportType}</config-property>
                        <config-property name="queueManager">${mq.manager}</config-property>
                        <config-property name="port">${mq.port}</config-property>                            
                    </connection-definition>
                </connection-definitions>
                <admin-objects>
                    <admin-object class-name="com.ibm.mq.connector.outbound.MQQueueProxy" jndi-name="java:jboss/jms/abcQueue" enabled="true" use-java-context="true" pool-name="jms/abcQueuePool">
                        <config-property name="targetClient">MQ</config-property>
                        <config-property name="persistence">PERS</config-property>
                        <config-property name="expiry">UNLIMITED</config-property>
                        <config-property name="baseQueueName">${my.abc.queue}</config-property>
                        <config-property name="arbitraryProperties">mdMessageContext="2",mdWriteEnabled="true",mdReadEnabled="true"</config-property>
                        <config-property name="baseQueueManagerName">${mq.manager}</config-property>
                    </admin-object>                       
                </admin-objects>
            </resource-adapter>

            <resource-adapter id="com.solacesystems.ra">
                <archive>sol-jms-ra-7.1.2.248.rar</archive>
                <transaction-support>NoTransaction</transaction-support>
                <config-property name="extendedProps">${solace.extendedproperties}</config-property>
                <config-property name="UserName">${solace.username}</config-property>
                <config-property name="MessageVPN">${solace.vpn}</config-property>
                <config-property name="ConnectionURL">${solace.connectionurl}</config-property>
                <config-property name="Password">${solace.password}</config-property>
                <connection-definitions>
                    <connection-definition class-name="com.solacesystems.jms.ra.outbound.ManagedJMSConnectionFactory" jndi-name="java:jboss/jms/solaceMessageConnectionFactory" enabled="true" pool-name="solaceMessageCFPool">
                        <config-property name="ConnectionFactoryJndiName">${solace.connectionfactory}</config-property>
                        <security>
                            <application/>
                        </security>
                        <validation>
                            <background-validation>false</background-validation>
                        </validation>
                        <recovery>
                            <recover-credential>
                                <user-name>${solace.username}</user-name>
                                <password>${solace.password}</password>
                            </recover-credential>
                        </recovery>
                    </connection-definition>
                </connection-definitions>
                <admin-objects>
                    <admin-object class-name="com.solacesystems.jms.ra.outbound.TopicProxy" jndi-name="java:jboss/jms/xyzMessageTopic" enabled="true" use-java-context="false" pool-name="xyzMessageTopicPool">
                        <config-property name="Destination">${xyz.topic}</config-property>
                    </admin-object>
                </admin-objects>
            </resource-adapter>
        </resource-adapters>
    </subsystem>
</profile>

In above file, basically we have defined two resourceAdapters one for WMQ and one for Solace.

  • Under <mdb> tag we have defined the default resource adapter name and defined <bean-instance-pool-ref value to limit the instance pool that is used by default for Message Driven Beans.
  • For few of the MDBs we have explicitly overriden the instance pool value per bean using jboss-ejb3.xml

Since we have multiple message driven beans listening to both WMQ and SOLACE, My question is:

  1. Will the MDBs (listening to both WMQ queues and SOLACE queues) for which we haven't defined the explicit pool in jboss-ejb3.xml share the same default pool defined under tag i.e.

    <mdb>
        <resource-adapter-ref resource-adapter-name="wmq.jmsra.rar"/>
        <bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
    </mdb>
    
  2. Or is it like default pool will apply only to MDBs listening to WMQ queues.

  3. If the default pool is applied only to MDBs listening to WMQ queues, what happens to MDBs listening to Solace queues that have no pool size defined in either standalone.xml or jboss-ejb3.xml

Solution

  • 1) MDBs that do not have an instance pool specified will use the default mdb-strict-max-pool. You can define your own pools (which I recommend):

            <pools>
                <bean-instance-pools>
                    <strict-max-pool name="slsb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
                    <strict-max-pool name="mdb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
                    <strict-max-pool name="MyPool" max-pool-size="10" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
                </bean-instance-pools>
            </pools>
    

    and then use the annotation:

    import org.jboss.ejb3.annotation.Pool;
    
    @Pool(value="MyPool") 
    

    in the MDB. This can also be done in the deployment descriptor file.

    2) See above. I prefer an instance pool per MDB deployment. I do not like MDBs competing for the instance pool.

    3) Same as above. Note that you can see the instance pool name that the MDB deployment is using in JMX. Note that if you have separate instance pools, the pool statistics become much more meaningful.