Red Hat Training

A Red Hat training course is available for JBoss Enterprise SOA Platform

Chapter 13. Other Java Message Service Provider Configuration Options

13.1. Configure Java Message Service Listeners and Gateways

Follow these steps to make your JMS listeners and gateways listen to queues and topics. jboss-esb.xml configuration file:

Procedure 13.1. Task

  1. Open the Configuration File

    vi jboss-esb.xml
  2. Edit the File

    Specify the following parameters:
    • jndi-URL
    • jndi-context-factory
    • jndi-pkg-prefix
    • connection-factory
    • destination-type
    • destination-name

    Important

    Make sure you include your JMS provider's client's JAR files in the class-path.
  3. Save

    Save the file and exit the text editor.

13.2. JmsConnectionPool

As its name implies, the JmsConnectionPool pools Java Message Service sessions. It is used by every JMS-based component, including the listeners, couriers and routers.
Some Java Message Service providers limit the number of JMS sessions allowed per connection. As a result, the JBoss Enterprise Service Bus' JMS components utilize a mechanism that controls the maximum number of sessions created from each JMS connection that is managed by a single JmsConnectionPool instance.

13.3. Set the Maximum Number of Sessions Per Connection

Procedure 13.2. Task

  1. Open the Relevant Configuration File

    Open the component in question's JNDI configuration file in a text editor.
  2. Set the relevant Properties

    You can edit these two properties: max-sessions-per-connection and max-xa-sessions-per-connection
    You must set the parameters as generic properties in the JMS provider configuration files. This example code demonstrates how to do so:
    <jms-provider ...>
    	<property name="max-sessions-per-connection" value="5" />
    	<property name="max-xa-sessions-per-connection" value="1" />
    	<!-- And add providers.... -->
    </jms-provider>
    

    Note

    If you do not configure either of these parameters, then the JmsConnectionPool creates a single JMS connection and derives every session from it.

13.4. JNDI Configuration File Properties

Table 13.1. JNDI Configuration File Properties

Property Description
max-sessions-per-connection This is the maximum total number of sessions allowed per connection (for both extended (XA) and non-XA session instances.) The default value is the same as the maximum number of JMS sessions allowed for the JmsConnectionPool as a whole, (which you can configure by changing the setting in the jbossesb-properties.xml file. The default is twenty.)
max-xa-sessions-per-connection This is the maximum number of XA sessions allowed per connection. The default value is the same as that which has been set for max-sessions-per-connection.

13.5. jms-jca-provider

The jms-jca-provider is a dedicated configuration for the JMS Java Connector Architecture (JCA). The jms-jca-provider facilitates JCA message inflow by providing two ways of connecting to the JMS provider, these being a gateway and an ESB-aware JMS message listener.

13.6. Configure the jms-jca-provider

Procedure 13.3. Task

  1. Edit the Configuration File

    Open the configuration file in a text editor and modify the settings. Here is a sample:
    <jms-jca-provider connection-factory="XAConnectionFactory" name="JBossMessaging">
    	<jms-bus busid="ordersGwChannel">
    		<jms-message-filter dest-name="queue/orders" dest-type="QUEUE" transacted="true"/>
    	</jms-bus>
    		<activation-config>
    			<property name="dLQMaxResent" value="5"/>
    		</activation-config>
    </jms-jca-provider>
    
  2. Save

    Save the file and exit.

13.7. jms-jca-provider Configuration Options

The jms-jca-provider settings configure two different parts of the system, these being as follows:
  1. The JCA inflows (which are on the server side).
    You can configure these items for them:
    • The JCA Adapter Name. This is configured as an attribute on the <jms-jca-provider>element.
    • The JCA Provider Adapter JNDI. This is configured as an attribute on the <jms-jca-provider> element.
    • The JCA Endpoint Class. This is configured as an attribute on the <jms-jca-provider> element.
    • The transacted flag. This is configured as an attribute on the <jms-jca-provider> element.
    • The message type. This is configured as an attribute on the <jms-jca-provider> element.
    • The JCA bridge. This is configured as an attribute on the <jms-jca-provider> element.
    • The JCA adapter activation configuration. This is configured in the <activation-config> element inside the <jms-jca-provider>.

    Note

    The JCA activation configuration also extracts some configuration properties for the JCA Inflow from the <jms-bus> and <jms-message-filter> that are nested inside the <jms-jca-provider> element. These include the destination type, destination name and message selector.
  2. The JMS connection details (which are on the client side), used to deliver messages to the JMS JCA inflows (which are either gateways or ESB-aware listeners.)
    These settings are used to generate the end-point reference for clients connecting to the JMS JCA inflow. They include the following:
    • The JMS connection factory to be used by the client. This is configured as an attribute on the <jms-jca-provider> element.
    • The JMS JNDI properties to be used by the client for connecting to the JMS provider. These are configured as an attributes on the <jms-jca-provider> element (jndi-*).
    • The JMS bus endpoint destination configurations. These are configured on the <jms-message-filter> elements inside the <jms-bus> within the <jms-jca-provider> element.
Make sure that the JMS client connection configurations outlined above are not configured to connect through JCA managed resources. The JMS client connection configurations should connect directly to the JMS Provider and not through JCA managed resources. This is important because this information is built into the end-point references used by the JBoss Enterprise SOA Platform's ServiceInvoker class, as well as other components that use the system's connection pooling functionality. (It is important to avoid using this to pool JCA-managed connections.)
These are the components that utilize the connection pooling feature:
  1. Routing actions that use the ServiceInvoker class such as the static- and content-based routers.
  2. Any gateway listeners that deliver messages to an action pipeline that is serviced by an ESB-aware JMS listener that, in turn, uses a JCA JMS provider. (Most of these gateway listeners deliver messages using the ServiceInvoker class.)
  3. The JMS Router.
Make sure you connect these components directly to the JMS provider and not through local JCA-managed resources.

13.8. JNDI Extension Properties

By default, the JNDI Java Message Service's resource retrieval configuration inherits every property that is prefixed with java.naming.
Some Java Message Service providers specify different naming prefixes. In order to support these, the JBoss Enterprise SOA Platform allows you to specify custom property prefixes for each provider.

13.9. Configure JNDI Extension Properties

Procedure 13.4. Task

  1. Add the jndi-prefixes for the Appropriate JMS Provider Element

    Open the configuration file in a text editor and add the jndi-prefixes for the appropriate JMS provider element with a comma-separated list of the additional prefixes you want to use:
    <jms-provider name="JMS" connection-factory="ConnectionFactory">
    <property name="jndi-prefixes” value="test.prefix." />
    <property name="test.prefix.extension1" value="extension1" />
    <property name="test.prefix.extension2" value="extension2" />
    </jms-provider>
    

    Note

    You can also configure the extensions property in this same location.
  2. Save

    Save the file and exit.