The Enterprise Server’s Java Message Service represents the connector module (resource adapter) for the Message Queue. You can manage the Java Message Service through the Admin Console or the asadmin command-line utility.
MQ brokers (JMS hosts) run in a separate JVM from the Enterprise Server process. This allows multiple Enterprise Server instances or clusters to share the same set of MQ brokers.
In Enterprise Server, a JMS host refers to an MQ broker. The Enterprise Server’s Java Message Service configuration contains a JMS Host List (also called AddressList) that contains all the JMS hosts that will be used.
In the Admin Console, you can set JMS properties using the Java Message Service node for a particular configuration. You can set properties such as Reconnect Interval and Reconnect Attempts. For more information, see Chapter 4, Configuring Java Message Service Resources, in Sun GlassFish Enterprise Server 2.1 Administration Guide.
The JMS Hosts node under the Java Message Service node contains a list of JMS hosts. You can add and remove hosts from the list. For each host, you can set the host name, port number, and the administration user name and password. By default, the JMS Hosts list contains one MQ broker, called “default_JMS_host,” that represents the local MQ broker integrated with the Enterprise Server.
Configure the JMS Hosts list to contain all the MQ brokers in the cluster. For example, to set up a cluster containing three MQ brokers, add a JMS host within the Java Message Service for each one. Message Queue clients use the configuration information in the Java Message Service to communicate with MQ broker.
In addition to the Admin Console, you can use the asadmin command-line utility to manage the Java Message Service and JMS hosts. Use the following asadmin commands:
Configuring Java Message Service attributes: asadmin set
Managing JMS hosts:
Managing JMS resources:
For more information on these commands, see Sun GlassFish Enterprise Server 2.1 Reference Manualor the corresponding man pages.
There are two types of integration between Enterprise Server and MQ brokers: local and remote. You can set this type attribute on the Admin Console’s Java Message Service page.
If the Type attribute is LOCAL, the Enterprise Server will start and stop the MQ broker. When Enterprise Server starts up, it will start the MQ broker specified as the Default JMS host. Likewise, when the Enterprise Server instance shuts down, it shuts down the MQ broker. LOCAL type is most suitable for standalone Enterprise Server instances.
With LOCAL type, use the Start Arguments attribute to specify MQ broker startup parameters.
If the Type attribute is REMOTE, Enterprise Server will use an externally configured broker or broker cluster. In this case, you must start and stop MQ brokers separately from Enterprise Server, and use MQ tools to configure and tune the broker or broker cluster. REMOTE type is most suitable for Enterprise Server clusters.
With REMOTE type, you must specify MQ broker startup parameters using MQ tools. The Start Arguments attribute is ignored.
You can specify the default JMS Host in the Admin Console Java Message Service page. If the Java Message Service type is LOCAL, then Enterprise Server will start the default JMS host when the Enterprise Server instance starts.
To use an MQ broker cluster, delete the default JMS host, then add all the MQ brokers in the cluster as JMS hosts. In this case, the default JMS host becomes the first JMS host in the JMS host list.
You can also explicitly set the default JMS host to one of the JMS hosts. When the Enterprise Server uses a Message Queue cluster, the default JMS host executes MQ-specific commands. For example, when a physical destination is created for a MQ broker cluster, the default JMS host executes the command to create the physical destinations, but all brokers in the cluster use the physical destination.