Sun GlassFish Message Queue 4.4 Administration Guide

Starting Clients

Before starting a client application, obtain information from the application developer about how to set up the system. If you are starting Java client applications, you must set the CLASSPATH variable appropriately and make sure you have the correct .jar files installed. The Message Queue Developer’s Guide for Java Clients contains information about generic steps for setting up the system, but your developer may have additional information to provide.

To start a Java client application, use the following command line format:

   java clientAppName

To start a C client application, use the format supplied by the application developer (see Building and Running C Clients in Sun GlassFish Message Queue 4.4 Developer’s Guide for C Clients).

The application’s documentation should provide information on attribute values that the application sets; you may want to override some of these from the command line. You may also want to specify attributes on the command line for any Java client that uses a Java Naming and Directory Interface (JNDI) lookup to find its connection factory. If the lookup returns a connection factory that is older than the application, the connection factory may lack support for more recent attributes. In such cases, Message Queue sets those attributes to default values; if necessary, you can use the command line to override these default values.

To specify attribute values from the command line for a Java application, use the following syntax:

   java  [ [-Dattribute=value] … ]  clientAppName

The value for attribute must be a connection factory administered object attribute, as described in Chapter 19, Administered Object Attribute Reference. If there is a space in the value, put quotation marks around the


part of the command line.

The following example starts a client application named MyMQClient, connecting to a broker on the host OtherHost at port 7677:

   java  -DimqAddressList=mq://OtherHost:7677/jms  MyMQClient

The host name and port specified on the command line override any others set by the application itself.

In some cases, you cannot use the command line to specify attribute values. An administrator can set an administered object to allow read access only, or an application developer can code the client application to do so. Communication with the application developer is necessary to understand the best way to start the client program.