Blog Stats
  • Posts - 90
  • Articles - 0
  • Comments - 29
  • Trackbacks - 0

 

How long MSMQ queue names are displayed ... or not

A few companies pack huge amounts of useful information into their queue names so that it is very easy to work out what each queue is for. A downside of this is that some Windows applications inconsistently display the queue names.

Take the following sample public and private queues I created for test, each 70 characters in length:

 CompMan64char 

Performance Monitor can only display 64 characters for the MSMQ queue object which includes the computer name (and "\private$" for private queues) as documented here:

As you can see below, the 70-character private queue becomes 41 characters long after "servername\private$\" is taken into account:

 perfmon64char

The observant amongst you will notice that this only accounts for 63 characters - there is always an invisible NULL character in the 64th position.

Now on the other hand, the Server Explorer in Visual Studio can display long private queues but has trouble with public queues:

VStudio64char

The reason for this is that the queue name is handled differently. Unlike Performance Monitor, there is no fixed 64-byte limit in the application. Instead the limit is in how queue names are stored in Active Directory. 

If we look at the configuration file (found in the system32\msmq\storage\lqs subdirectory) for the private queue:

[Properties]
QueueName=\private$\1111111111222222222233333333334444444444555555555566666666667777777777

all the characters are stored in one place.

For public queues, though, only the first 64 characters will fit in the field used to store the name in Active Directory and the remainder of the name gets stored in another field (mSMQQueueNameExt).

Depending on the operation, MSMQ performs :

  • two Active Directory lookups to get the full name (as seen in Computer Management), or
  • one Active Directory lookup to get the distinguished name where a “hash” suffix is used for long names instead (as seen in VS Server Explorer)

There is a more important "Gotcha" although you are VERY unlikely to see it. It goes like this:

  1. Create a public queue called "1111111111222222222233333333334444444444555555555566666666667777777777". As in the screenshot above, this will have a distinguised name of "1111111111222222222233333333334444444444555555555566666-0A479588".
  2. Create a public queue called "1111111111222222222233333333334444444444555555555566666-0A479588".
  3. Send a message to the first public queue name - the message will arrive in the specified queue.
  4. Send a message to the second public queue name - the message will arrive in the first public queue.

Personally I can't see any real-world scenarios where somebody would get this problem but I thought I would add it for completeness.

 

Best practice - stick to 63 characters for public or private queues and you won't go wrong.


Feedback

# re: How long MSMQ queue names are displayed ... or not

Gravatar very nice article 8/18/2011 1:46 PM | Nabeel

# What is this blog about?

Gravatar I was searching for blogs about plumbing and came across yours, but I am not sure what your blog is about? What is Plumbersmate? Thanks 6/5/2012 9:50 PM | J. Herranen

# re: How long MSMQ queue names are displayed ... or not

Gravatar Thanks for the reply in my email, hope my question didn't sound rude. 6/20/2012 3:56 AM | TTopPlumbing

# re: How long MSMQ queue names are displayed ... or not

Gravatar Thanks for your post! 9/4/2012 1:24 AM | Leak Detection San Clemente

# re: How long MSMQ queue names are displayed ... or not

Gravatar I was doing a search for some plumbing stuff and stumbled across this page. What is a plumbersmate? 11/6/2012 5:43 PM | Leak Detection Laguna Niguel

Post A Comment
Title:
Name:
Email:
Comment:
Verification:
 

 

 

Copyright © John Breakwell