MSMQTest.txt

MSMQTest is installed on all MSMQ workstations and servers by default.
You can use MSMQTest to test and demonstrate MSMQ functionality. 
Install the MSMQ SDK to install other MSMQ sample applications.

MSMQTest demonstrates basic MSMQ functionality in a complete C 
program, including usage of Queue and Message properties and many of 
the MSMQ APIs. MSMQTest sends messages between two or more computers,
or between two instances of MSMQTest on the same computer. You can 
run MSMQTest either as a receiving application (using the -r 
parameter) or as a sending application (using the -s parameter). You 
can run multiple instances of the application in sending or receiving 
mode. All messages you send from an instance of MSMQTest are sent to 
all the MSMQTest queues created by computers running MSMQTest in 
receiving mode. Similarly, computers running MSMQTest in receiving 
mode receive messages from all instances of MSMQTest in sending mode. 

Note:  When you install the MSMQ SDK, the MSMQTest source file, 
Msmqtest.c, is installed.

The following procedure introduces MSMQTest, demonstrating how you 
can use it to observe basic message queuing functionality.

To use MSMQTest:

1. Run two instances of the Windows NT command prompt or the 
   Windows 95 MS-DOS prompt, either on one computer or on two 
   different computers. 

2. In each instance, change to the MSMQ directory (c:\ program 
   files\msmq by default).

3. In one instance, start MSMQTest in receive mode by typing 
   msmqtest -r and then pressing ENTER.

   If you run MSMQ Explorer, you see an msmqtest queue has been 
   created on the computer you are using. The queue has no messages.

4. In the other instance, start the MSMQTest in send mode by typing 
   msmqtest -s, and then pressing ENTER.

5. At the Enter a string: prompt, type some text (for example, Hello 
   World) and then press ENTER.

   The text you types in the sending application appears in the 
   receiver's command prompt window. If you look at the msmqtest queue
   in MSMQ Explorer, you see it still has no messages. Because all the
   messages have been received by the receiving application, they do
   not appear in the queue.

6. In the command prompt window running MSMQTest in receiving mode, 
   press CTRL+C to exit MSMQTest.

7. In the MSMQTest sending window, type some additional text and press
   ENTER.

   If you look at the msmqtest queue in MSMQ Explorer, you see the 
   messages the sending application has sent, but that MSMQ has not 
   yet been able to deliver because the receiving application is no 
   longer running.

8. Restart MSMQTest in receiving mode by typing msmqtest -r, and then
   pressing ENTER.

   The messages stored by MSMQ are immediately delivered to the 
   receiving application. If you switch to MSMQ Explorer and press F5
   to refresh the display, you see that the queue has no messages 
   because all the messages have been read by the receiving 
   application.

9. In the MSMQTest sending window, type quit in lowercase, and then 
   press ENTER.

If you switch to MSMQ Explorer and press F5to refresh the display, you
see that the queue has been deleted. If you exit the sending 
application by pressing CTRL+C, the queue is not deleted. The queue is
deleted only when you exit the sending application by typing quit in 
lowercase, and then pressing ENTER. 

If you exit the sending application while there are undelivered 
messages in the receiving application queue, the queue is not removed.
However, if you run MSMQTest in receiving mode again, it empties the 
queue (displaying each message), removes the queue, and then exits.

