LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Microsoft Message Queues (MSMQ) with LabVIEW

I want to use the Microsoft Message Queue to communicate between applications on different machines. Does anybody have experience in using the MSMQ with Labview (in the .NET framework)? How do I send messages? The MessageQueue.Send method requires an object, and I don't know how to create this object format.
 
This question was asked several years ago on this forum and no answer was given.
 
I would appreciate any examples of Create a Queue, Delete a Queue,  Send a Message, and Read a Message in LabVIEW 7 or earlier.
 
Thanks,
0 Kudos
Message 1 of 19
(5,238 Views)
You just need to use the .NET constructor to create the message queue object. Place a .NET constructor node, select "System.Messaging" and then select "MessageQueue". Select the constructor you want and there's your object.

You should be aware that you cannot use .NET in LabVIEW earlier than 7. You had requested samples in LabVIEW 7 or earlier. Also, if you're going to use .NET 2.0  you will need at least 7.1, preferably 7.1.1f2.
Message 2 of 19
(5,208 Views)

Thanks for your suggestions.

Maybe I should state the problem differently: How do I get the desired Message into the Object that I input to the Send Method for MSMQ?

I've attached a simple VI that sends a message with nothing in it to Message Queue in "Computer Management." How do I get it to send a message.

Thanks,

 

0 Kudos
Message 3 of 19
(5,201 Views)
P.C.,
 
In order to send a Message in the MessageQueue that you have just created, you will need to use another constructor node and create a Message object.  You can then use the property and invoke nodes to change the values of that object and call the functions of that Message object.  You then only need to put this newly created Message object on your queue and you are good to go.
 
As a reference, you may want to check out the documentation on Microsoft's website about these particular objects.  It is located here:
 
 
I hope this helps.
Brian Coalson

Software Engineer
National Instruments
0 Kudos
Message 4 of 19
(5,164 Views)

Brian:

Thanks for your help! I'm making progress in getting the information I need to get Microsoft Message Queues to work with LabVIEW.

I seem to be missing only one thing: There is an object called Body that is used to input and output messages in Message. It is wired to the Message property Body. It seems to be called using an invoke node. Do you know where that is found and called?

Thanks,

 

 

 

0 Kudos
Message 5 of 19
(5,155 Views)
P.C.
 
I believe that the Body object can take in text or binary information.  If you use a To .NET Object.vi and wire in a string, that should allow you to send a message with the string as the body of the message.  Here is a more detailed list of the message object:
 
Brian Coalson

Software Engineer
National Instruments
0 Kudos
Message 6 of 19
(5,155 Views)

Brian:

I'm trying to construct something like the attached diagram, but I can't figure out how to find the class and method for the invoke node named Object in this diagram.

Thanks,

P.C.

 

0 Kudos
Message 7 of 19
(5,157 Views)
P.C.
 
I'm a little confused by what you mean.  I thought you were sending messages through the MSMQ, but the code there would receive a message, get the body, then display the body of the message.  The Object that the invoke node refers to is the Body of the Message, which has no properties, but has a few methods like ToString that you can use to get the string from the Body. 
 
You need to wire up the references into the invoke and property nodes to get the selection of the methods or properties that are available.  Do they just not appear when you are using the invoke node with a reference to the body?

Message Edited by Coal Man on 06-04-2007 01:56 PM

Brian Coalson

Software Engineer
National Instruments
0 Kudos
Message 8 of 19
(5,149 Views)

Brian:

When I place an invoke node on the diagram and connect a wire from the Message property node with the "Body" property, the invoke node shows not methods, no title (Object), and the VI indicates that an error of the incorrect class or method is applied to the invoke node.

P.C.

 

0 Kudos
Message 9 of 19
(5,144 Views)
P.C. 
 
I'm not sure why it would be giving you that error.  What versioin of MSMQ do you have?  I have attached a VI that I got the screenshot from.  Are you able to open it and see the same error?
 
 
Brian Coalson

Software Engineer
National Instruments
0 Kudos
Message 10 of 19
(5,138 Views)