Running other MQe JMS example programs

MQe provides two other example programs for the JMS classes. The program examples.jms.PTPSample01 is similar to the IVT examples described above, but there is a command line argument to tell it not to use the Java™ Naming and Directory Interface (JNDI) and it does not have the same checks on the class path. The program requires the same JMS and MQe jar files on the class path as examples.jms.MQeJMSIVT, that is jms.jar, MQeJMS.jar, MQeBase.jar, and MQeExamples.jar. It also requires the jndi.jar file, even if it does not use JNDI, because the program imports javax.naming. The section on Using JNDI provides more information on the jndi.jar file. You can run the example from the command line by typing:
 java examples.jms.PTPSample01 -nojndi -i <ini file name>
where <ini file name > is the name of the initialization (ini) file for the MQe queue manager. By default, the program will use the SYSTEM.DEFAULT.LOCAL.QUEUE on this queue manager. You can specify a different queue by using the -q flag:
java examples.jms.PTPSample01 -i <ini file name> -q <queue name> 
You can also turn tracing on by adding the -t flag:
java examples.jms.PTPSample01 -t -i <ini file name> -q <queue name> 

The examples.jms.PTPSample02 program uses message listeners and filters. This program creates a QueueReceiver with a "blue" filter and creates a message listener for it. It creates a second QueueReceiver with a "red" filter and message listener. It then sends four messages to a queue, two with the filter property colour set to blue and two with the filter property colour set to red, and checks that the message listeners receive the correct messages. The program has the same command line parameters as examples.jms.PTPSample01.


Terms of use | WebSphere software

(c) Copyright IBM Corporation 2004, 2005. All rights reserved.