• RV
    • Missy – My Home
    • JBAM – Newmar Dutch Star
    • Shaneeda
    • Buying a Used RV
    • Gas vs Diesel RVs
    • Ideal Motorhome
    • Choosing the Ideal RV
  • Cycling
  • Jeep
  • About
  • Flying
    • Vans RV-4
    • Daisy – RV-3B
  • Resources
  • Subscribe

JdFinley.com

Fulltime RV Living Adventures

  • Is Solar For You?
  • Gas vs Diesel RVs
  • Buying a Used RV
  • Choosing the Ideal RV
  • Ideal Motorhome

MSMQ – Receive Remote Message

August 6, 2011

This is a continuation of how to utilize Microsoft Message Queuing (MSMQ) in your application. The previous post on the subject is here.

Robot VB.Net C#.Net Software Development Message Queuing MSMQ SQLIn most cases; the application, service, or web site that reads from an MSMQ will be local to that queue (on the same Windows computer or virtual machine).  However; there are exceptions.  The one with which I have the most experience is when the MSMQ resource is clustered.  In this case, my service is running on one of the nodes of the failover cluster but the Queue is running on the virtual instance of the cluster.

As previously noted, the Microsoft .Net Framework System.Messaging namespace contains the required classes for working with Message Queuing in C#.Net, VB.Net, VBScript, and so forth.

There are several ways to address a remote queue. The following examples use the Direct OS and TCP approaches.  There are several other possibilities including sending via HTTP (which is an awesome option but will have to save that for another post).
“FormatName:DIRECT=OS:MyComputer\private$\TestQueue”
“FormatName:DIRECT=TCP:10.200.1.1\private$\TestQueue”

For Each _messageQueue As MessageQueue In MessageQueue.GetPrivateQueuesByMachine("ServerName")
If _messageQueue.QueueName.ToUpper = "NAMEOFQUEUE" Then
If Not _messageQueue.CanRead Then
' Queue permissions not set properly
Return Nothing
End If

Return _messageQueue
End If
Next

The trick to note is that you cannot simply obtain a reference to the queue by name.  You must obtain a reference to that machines Queue Collection and then iterate thru that collection until finding the desired queue. You then have a reference to the MessageQueue.  Once you have that reference, you may use any of the normal MessageQueue methods (Peek, Receive, ReceiveById, etc…).

Also note the check of the MessageQueue.CanRead property.  As previously noted, security/permission is often the thing that causes the most problems in the development sandbox.

For more message queuing implementation details try these additional posts:

  • Message Queuing
  • Receiving MSMQ Messages
(Visited 771 times, 1 visits today)

Related posts:

Default ThumbnailMSMQ – Receive Message Default ThumbnailMessage Queuing Default ThumbnailXML Serialization Default ThumbnailBuffer Size

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Once you have flown, you will walk the earth with your eyes turned skyward, for there you have been, there you long to return.

— da Vinci

Popular Posts

  • Powermatic Model 90 Wood Lathe & VFD
  • Wood Turning on a Lathe
  • Chainsaw Review: Sportsman 20 in. 52cc
  • Cielo Grande Barbed Wire Fence Repair

Email Notification


 

Posts by Subject

3DPrinting Aircraft Airstrip Bible Bus bus boys Camping Cat Computers Cycling Development Electrical electronics Entertainment Environment Factory Five family FAQ Finances flying Food God Health Holiday Home Humor kayak Life Maintenance Nature Photography Review RV-3 RV-4 sailboat sailing self improvement Sewing solar Travel Video weather wood woodworking X-Country

Posts by Month

© Copyright © 2025 JDFinley.com · All Rights Reserved · Privacy Policy

Unauthorized use and/or duplication of this material without express and written permission from this site’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to JD Finley and JdFinley.com with appropriate and specific direction to the original content.