7.4.1. org.jboss.jms.jndi.JMSProviderLoader MBean

7.4.1. org.jboss.jms.jndi.JMSProviderLoader MBean

The JMSProviderLoader MBean service creates a JMS provider adaptor and binds it into JNDI. A JMS provider adaptor is a class that implements the org.jboss.jms.jndi.JMSProviderAdapter interface. It is used by the message driven bean container to access a JMS service provider in a provider independent manner. The configurable attributes of the JMSProviderLoader service are:

<mbean code="org.jboss.jms.jndi.JMSProviderLoader"
       name="jboss.mq:service=JMSProviderLoader,name=RemoteJBossMQProvider">
    <attribute name="ProviderName">RemoteJMSProvider</attribute>
    <attribute name="ProviderUrl"></attribute>
    <attribute name="ProviderAdapterClass">
        org.jboss.jms.jndi.JBossMQProvider
    </attribute>
    <attribute name="FactoryRef">XAConnectionFactory</attribute>
    <attribute name="QueueFactoryRef">XAConnectionFactory</attribute>
    <attribute name="TopicFactoryRef">XAConnectionFactory</attribute>
    <attribute name="Properties>
        java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
        java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
        java.naming.provider.url=jnp://remotehost:1099
    </attribute>
</mbean> 

Example 7.13. A JMSProviderLoader for accessing a remote JBossMQ server


The RemoteJMSProvider can be referenced on the MDB invoker config as shown in the jboss.xml fragment given in Example 7.14, “ A jboss.xml fragment for specifying the MDB JMS provider adaptor”.

<proxy-factory-config>
    <JMSProviderAdapterJNDI>RemoteJMSProvider</JMSProviderAdapterJNDI>
    <ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
    <MaximumSize>15</MaximumSize>
    <MaxMessages>1</MaxMessages>
    <MDBConfig>
        <ReconnectIntervalSec>10</ReconnectIntervalSec>
        <DLQConfig>
            <DestinationQueue>queue/DLQ</DestinationQueue>
            <MaxTimesRedelivered>10</MaxTimesRedelivered>
            <TimeToLive>0</TimeToLive>
        </DLQConfig>
    </MDBConfig>
</proxy-factory-config>

Example 7.14.  A jboss.xml fragment for specifying the MDB JMS provider adaptor


Incidentally, because one can specify multiple invoker-proxy-binding elements, this allows an MDB to listen to the same queue/topic on multiple servers by configuring multiple bindings with different JMSProviderAdapterJNDI settings.

Alternatively, one can integrate the JMS provider using JCA configuration like that shown in Example 7.15, “A jms-ds.xml descriptor for integrating a JMS provider adaptor via JCA”.

<tx-connection-factory>
    <jndi-name>RemoteJmsXA</jndi-name>
    <xa-transaction/>
    <adapter-display-name>JMS Adapter</adapter-display-name>
    <config-property name="JMSProviderAdapterJNDI"
                     type="java.lang.String">RemoteJMSProvider</config-property>
    <config-property name="SessionDefaultType"
                     type="java.lang.String">javax.jms.Topic</config-property>
                
    <security-domain-and-application>JmsXARealm</security-domain-and-application>
</tx-connection-factory>

Example 7.15. A jms-ds.xml descriptor for integrating a JMS provider adaptor via JCA