Re: MSMQ with Labview
- From: HJPhilippi <x@xxxxxxxx>
- Date: Thu, 4 Oct 2007 03:40:15 -0500 (CDT)
Jim,
please find attached an MSMQ send/receive example I've created with LabVIEW 8.2.1To get it working, you need to do the following:
1. Make sure MSMQ is installed on all involved machines, senders and receivers. The attached ZIP archive contains batch files to install MSMQ on Windowx XP and Vista in the so-called workgroup mode (does not involve active directory integration).
2. Manually create a private queue named "labQueue" or whatever you like on the receiving(!) MSMQ target machine.See <a href="http://technet2.microsoft.com/windowsserver/en/library/53f029d6-8824-4b1b-a312-167b03f5fca51033.mspx?mfr=true" target="_blank">http://technet2.microsoft.com/windowsserver/en/library/53f029d6-8824-4b1b-a312-167b03f5fca51033.mspx?mfr=true</a> for instructions to do so. Important note: people often misunterstand the term "private" in a way that such queues would only work locally, within one machine. This is not the case, in fact there is no kind of local-only receive queue like there is no local-only TCP port binding and private queues are open to get messages from anywhere. They are just not public to the active directory queue management services so any sender needs to know the correct target address itself.
3. Adapt the "FormatName" string of the SampleSender.vi that it points to the queue on the MSMQ receiver, that is: Insert the queue name you've chosen and replace the IP with the address of the target machine.
Run both VIs, SampleSender.vi and SampleReceiver.vi and send single messages typed into the "myMessage" string control by pressing the "Send" button or create looped bulk messages with the corresponding boolean switch control.To experience the coolness of MSMQ, send some messages from the running sender VI before the receiver was started, then start the receiver VI. Or run both VIs on 2 different machines, unplug the LAN connection of one while still sending messages and then plug it in again. MSMQ does all the caching for you in case one of the peers is temporarily unavailable. This rocks!
The VIs demonstrate a very straight forward use of the .NET System.Messaging namespace for synchronous MSMQ messaging. A more elaborate (and better) way included the automatic creation of non-exisiting receive queues and asynchronous message receiving with .NET events.
Greetings + have fun,Hans
MessageQueue (MSMQ).zip:
http://forums.ni.com/attachments/ni/170/276010/1/MessageQueue (MSMQ).zip
.
- Prev by Date: Re: search for FPGA boards ( VI_ATTR_MODEL_CODE )
- Next by Date: Re: Can send characters to the standard input while DOS Command is under execution
- Previous by thread: Re: search for FPGA boards ( VI_ATTR_MODEL_CODE )
- Next by thread: Re: MSMQ with Labview
- Index(es):
Relevant Pages
|