Java Message Service

This section describes Java Message Service (JMS) considerations for the JRun administrator. It includes descriptions of using the default JRun JMS provider, using the SonicMQ JMS implementation in place of the default JRun JMS provider, and how to configure factories and destinations.

The choice of JMS provider is controlled by settings in the jrun.xml file. In this file you indicate whether to use the JRun default JMS provider or a third-party JMS provider, such as SonicMQ. The jrun.xml file use the following services to define a JMS provider:

To modify the JMSAdapter and JMSServiceWrapper services, modify the jrun.xml file with a text editor.

Note:   In addition to using the JMS resources and examples in this book, you can get additional information on JMS administration and programming by consulting a trade press book that discusses JMS. The preface of this book includes a list of these books.

Using the default JMS provider

In addition to settings made in the jrun.xml file and the JMC, you use the SERVER-INF/jrun-jms.xml file to control the behavior of the JRun default JMS provider. Use a text editor to modify the jrun-jms.xml file; you do not use the JMC.

The jrun-jms.xml file has persistence settings and server settings.

Persistence manager settings

The default JMS provider supports the following persistence managers:
Persistence type
Description
File (default)
JRun stores messages beneath the SERVER-INF/jms directory using a proprietary protocol.
DBMS
JRun stores messages in a relational database, using messages, handles, consumers, and destinations tables. To use DBMS-based persistence, configure the database tables in your site-specific database, using the scripts found in the SERVER-INF/jms directory. You must also define a data source in the jrun-jms.xml file. This data source cannot have the same name as an existing data source in the same JRun server.

The jrun-jms.xml file's active-adapter-type element specifies the persistence type: file or rdbm. Optionally, you can control whether the JMS provider caches messages by using the cache element. Additionally, you can use the transact element to specify whether the DBMS provider uses transactionality. Other than these elements, you do not typically change elements in the jrun-jms.xml file.

JMS server settings

The jrun-jms.xml file also includes the following elements:
Element
Description
Transport
Specifies the transport mechanism used for the JMS provider: RMI or intraVM. These are the settings the JMC displays for queue and topic connection factories.
Connection-factory
Specifies settings for the default JMS provider's queue connection factory and topic connection factory.
Scheduler
Internal use. Do not modify this element.
Message manager
Specifies cache and thread settings.
Garbage-collection
Specifies garbage collection settings, in seconds.
Destinations
System destinations. Do not modify this element.
JNDI settings
Specifies the properties and values that clients must pass in a Properties object in the InitialContext constructor. When using the JRun server with remote clients, you must change PROVIDER_URL to that JRun server's actual host name (instead of localhost or 127.0.0.1) and JNDI port number.

Using other JMS providers with JRun

JRun lets you use third-party JMS providers in place of the JMS provider supplied as part of JRun. You can switch JMS providers by editing relevant sections of a JRun server's jrun.xml file.

Note:   JRun has been verified using version 3.5 of SonicMQ. Other versions of SonicMQ are currently not supported and SonicMQ 3.5 is the only third party JMS provider currently supported by JRun 4.0.

Using SonicMQ

This section explains the steps involved in using the Progess Software SonicMQ JMS implementation in place of the JMS provider built in to JRun.

When configured to use SonicMQ as its JMS provider, JRun will automatically start a dedicated instance of SonicMQ with which it will interact. The only requirement is that the dedicated instance use a port that does not conflict with any other SonicMQ instances running on the same host.

To install SonicMQ, follow the steps in the SonicMQ installation documentation. No special installation configuration of SonicMQ is required to support its use with JRun.

To configure JRun to use SonicMQ, use a text editor to change the JRun server's jrun.xml file to use the SonicMQ adapter and service wrapper instead of the built in JRun adapter and service wrapper. The default jrun.xml file includes commented-out examples of appropriate settings for the SonicMQ adapter and wrapper. You also make server specific settings for SonicMQ.

To configure JRun for SonicMQ:

  1. Open the JRun server's jrun.xml file (found in the jrun_root/servers/server_root/SERVER-INF directory).
  2. Locate the section starting with <service class="jrun.jms.adapter.JRunMQAdapter" name="JMSAdapter"> and comment it out.
  3. Locate the section starting with <service class="jrun.jms.wrapper.JRunMQServiceWrapper" name="JMSServiceWrapper"> and comment it out.
  4. Locate the two subsequent, corresponding, commented-out JMSAdapter and JMSServiceWrapper sections for the SonicMQ adapter and uncomment them so they are active. These sections begin with the following lines <service class="jrun.jms.adapter.SonicMQAdapter" name="JMSAdapter"> and <service class="jrun.jms.wrapper.SonicMQServiceWrapper" name="JMSServiceWrapper">.
  5. In the jrun.jms.adapter.SonicMQAdapter section, edit the following attributes to reflect your local SonicMQ installation:
    Attribute
    Description
    HomeDir
    Specify an absolute path to the directory where you installed SonicMQ; for example, C:\Program�Files\SonicSoftware\SonicMQ.
    ConfigFileName
    Specify the name of the SonicMQ configuration file that JRun will use when starting up its dedicated instance of Sonic.
    This file must be located in the directory specified by the HomeDir attribute.
    ClassPath
    Specify an entry for each of the following JAR files in the SonicMQ lib directory: client.jar, broker.jar, defdb_server.jar.
    This is a standard Java classpath specification so you must use appropriate, platform-specific separator characters and syntax. This is the minimum classpath required for SonicMQ. Depending on your local configuration and use of SonicMQ, this attribute might require other JARs from the SonicMQ lib directory.
    Port
    Specify a port for JRun-SonicMQ communication.
    This port must be available and it must not conflict with the port used by other SonicMQ instances running on the same host. This port setting only affects the Broker Manager (the connector used to communicate between JRun and Sonic).
    In order for SonicMQ to accept connections from this Broker Manager, you must also change the PORT line in the SonicMQ configuration file, located in the root directory of your SonicMQ installation, specified in the HomeDir attribute. By default the SonicMQ configuration file is named broker.ini. If you want JRun to use a different Sonic configuration file (and, therefore, start a different instance of Sonic than would be started on this host by default), you can specify the name of an alternative SonicMQ configuration file using the ConfigFileName attribute.
  6. Copy the SonicMQ client.jar and broker.jar files (located in the SonicMQ lib directory) to the jrun_root/servers/lib directory.

    JAR files found in this directory are automatically added to the classpath of any running JRun servers.

  7. Ensure that the transport attribute for JMS connection factories in the jrun-resources.xml file is set to TCPIP. The only transport type supported with SonicMQ is TCP/IP.

Configuring settings for factories and destinations

JRun manages the following types of JMS factories and destinations:

JMS connection factories allow clients (both senders and receivers) to establish a connection with JMS. The client accesses the connection factory with a JNDI lookup and uses the factory to create a connection. Clients also access destinations (that is, queues and topics) through JNDI.

You typically use the JMC to define factories, destinations, and their location in JNDI. JRun stores factory and destination information in the jrun-resources.xml file, which you can also edit manually. For more information on the jrun-resources.xml file, see "Resources: the jrun-resources.xml file" or the online descriptor documentation, available from the JRun documentation home page.

For more information on factories and destinations, see the JMC online help.

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/jrun/4/JRun_Administrators_Guide/resources3.htm