9.4. Specifying the MDB JMS Provider
javax.jms.ServerSessionPool and javax.jms.ServerSession, must be provided by the application server in which the processing will occur. Thus, the set of components that make up the JBossMQ ASF involves both JBossMQ components as well as JBoss server components. The JBoss server MDB container utilizes the JMS service's ASF to concurrently process messages sent to MDBs.
org.jboss.jms.jndi.JMSProviderLoader MBean. This MBean is responsible for loading an instance of the org.jboss.jms.jndi.JMSProviderAdaptor interface into the JBoss server and binding it into JNDI. The JMSProviderAdaptor interface is an abstraction that defines how to get the root JNDI context for the JMS provider, and an interface for getting and setting the JNDI names for the Context.PROVIDER_URL for the root InitialContext, and the QueueConnectionFactory and TopicConnectionFactory locations in the root context. This is all that is really necessary to bootstrap use of a JMS provider. By abstracting this information into an interface, alternate JMS ASF provider implementations can be used with the JBoss MDB container. The org.jboss.jms.jndi.JBossMQProvider is the default implementation of JMSProviderAdaptor interface, and provides the adaptor for the JBossMQ JMS provider. To replace the JBossMQ provider with an alternate JMS ASF implementation, simply create an implementation of the JMSProviderAdaptor interface and configure the JMSProviderLoader with the class name of the implementation. We'll see an example of this in the configuration section.
org.jboss.jms.asf.ServerSessionPoolFactory implementation using the org.jboss.jms.asf.ServerSessionPoolLoader MBean PoolFactoryClass attribute. The default ServerSessionPoolFactory factory implementation is the JBoss org.jboss.jms.asf.StdServerSessionPoolFactory class.
9.4.1. org.jboss.jms.jndi.JMSProviderLoader MBean
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:
- ProviderName: A unique name for the JMS provider. This will be used to bind the
JMSProviderAdapterinstance into JNDI underjava:/<ProviderName>unless overridden by theAdapterJNDINameattribute. - ProviderAdapterClass: The fully qualified class name of the org.jboss.jms.jndi.JMSProviderAdapter
interface to create an instance of. - FactoryRef: The JNDI name under which the provider
javax.jms.ConnectionFactorywill be bound. - QueueFactoryRef: The JNDI name under which the provider
javax.jms.QueueConnectionFactorywill be bound. - TopicFactoryRef: The JNDI name under which the
javax.jms.TopicConnectionFactorywill be bound. - Properties: The JNDI properties of the initial context used to look up the factories.
Example 9.13. A JMSProviderLoader for accessing a remote JBossMQ server
<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>
jboss.xml fragment given in Example 9.14, “ A jboss.xml fragment for specifying the MDB JMS provider adaptor”.
Example 9.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>
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.
Example 9.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>

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.