![]() |
|
||||
Exploring Sample MSMQ ApplicationsC_draw.exe
All these applications work across machines if MSMQ is properly installed
on each participating machine.
Exploring C_draw: Start two instances of C_draw.exe and connect them together via message queues. To do it: make them running under different names, say "Nik" and "Vik" (it asks for a name at startup), then attach Nik to Vik and Vik to Nik (by specifying the buddy name at "Remote Friend" edit box and then clicking the Attach button). Then start drawing things with a mouse in client area of any of the two. You would normally see that the drawing is immediately duplicated to the other application. Windows messages (mouse movements) are transmitted between two applications via a message queue. We can simulate a "broken network connectivity" condition by simply shutting down one client. Continue drawing in its client area for while. Now start another client again and reattach. You will see the picture duplicated on its screen as soon as connectivity is reestablished. One interesting detail of message queues may be revealed if you start
three clients on the same machine - two Viks and one Nik, and attach Nik
to Vik. Now two Viks will compete against one message queue. Some window
messages will get to one and some to the other. As a result, you would
not see solid lines on Viks anymore as you draw on Nik's client area.
Exploring Vb_draw: Vb_draw is an application very much similar to the C_draw. In fact, their user interfaces are identical. The difference is that it is written in Visual Basic. You can make two Vb_draw clients communicate to each other, or connect C_draw with Vb_draw. Development platform does not matter here because each of the applications is "talking" to the MSMQ interface. This may be easily accomplished in Visual Basic, as well as in Visual C++. One may easily see an opportunity here to connect two incompatible applications
via MSMQ as soon as both of them support MSMQ.
Exploring Msmqtest: This console application may run either in sender or in receiver mode. The sender sends string messages to all receivers. Obviously, as the application name suggests, you could easily test whether MSMQ works on a particular machine. The following command generates a receiver:
To create a server do the following:
Exploring Mqapitst: This GUI application is a useful tool to play with MSMQ. It gives you a visual interface to the MSMQ API thus allowing for easy message queue manipulation by means of menu options and toolbar buttons. For example, you can create, delete, open, close queues, send and receive messages via them. To exchange messages between two Mqapitst applications running on the same machine do the following:
|