13.2. The Microsoft Message QueueThe Microsoft Message Queuing Service (MSMQ) provides you, as the system administrator, with a way to collect messaging transactions from various messaging-aware applications and queue them until applications are ready to process them. Messages, in this case, aren't like email messages between human users, but are functional messages or data exchanged between applications. What is MSMQ used for? The MSMQ services come into play when one application wants to exchange a message with another application but that particular application isn't responding. When one person needs to communicate fairly quickly with another person, he typically uses a phone. If the person he is trying to reach isn't at his desk, and there is no voice mail or answering machine, the original caller needs to continue trying to reach the personwhich can turn into a big waste of time. However, if he can leave a voice mail message in the other person's message "queue," the caller can go on about his other work and wait for the other person to deal with the message and take any appropriate action. MSMQ works the same way, providing a storage-and-retrieval service for applications that are available to accept messages sent to them. This allows sending applications to get on with their other processes without dedicating resources to continuing attempts to transmit programming and service messages to unavailable applications. The queuethe holding bin for these messagescomes in different types and performs different functions:
13.2.1. Communications with MSMQThe basis of communications for MSMQ is the Active Directory site; thus, all message exchange between queues and applications is done within the context of your organization's Active Directory structure. MSMQ is a very chatty service and it uses a lot of network bandwidth, so make sure you place at least one MSMQ server in each Active Directory site or subnet to mitigate that effect. For traffic between sites, MSMQ uses routing links, which use the TCP/IP protocol to pass traffic to and from hosts. Where direct connections cannot be established, the MSMQ software routes messages according to rules dictating how messages should be transmitted. Messages that are routed move from station to stationor "hop" to "hop," as it is formally knownuntil the destination is reached. MSMQ attempts to route messages along the least costly route, where the cost is derived from the available bandwidth divided by the actual currency cost of the connection. (This requires outside math on your part.) You specify the cost of the link, similar to how you specify the cost of an AD site link, to MSMQ, and it takes that into account when routing messages between MSMQ servers. 13.2.2. MSMQ AdministrationAlthough much MSMQ detail is beyond the scope of this book, a lot of administrators find themselves administering MSMQ at least in part. With that in mind, the next section details some very common administrative tasks you can perform with the MSMQ. For a more detailed approach to MSMQ development and administration, consult a book or online resource dedicated to the topic. (I've listed one at the end of this section.) 13.2.2.1. Installing MSMQYou can easily install MSMQ from the Add/Remove Programs tool within the Control Panel. Open the tool and then select Add/Remove Windows Components from the left pane. Select Application Server, and then click the Details button. Finally, check the checkbox next to Message Queuing, and click OK and then Next to install the components. Some tips for best performance of MSMQ servers and links:
13.2.2.2. Finding an MSMQ serverTo find a machine that is running the MSMQ software, open Active Directory Users and Computers, and then do the following:
13.2.2.3. Setting a maximum message sizeYou might want to set a maximum message size for a particular system to compensate for disk space restraints or bandwidth concerns. To do so, take these steps:
13.2.2.4. Enabling and disabling journalsRecall that journals are simply copies of messages to track their history. To enable or disable journals, follow these steps:
13.2.2.5. Limiting journal sizeLike the maximum message size, you might want to constrain the amount of disk space available for journaling. To do so, follow these steps:
13.2.2.6. Finding a queueTo find an MSMQ queue within your organization, do the following:
13.2.2.7. Deleting a queueAt certain times, you might want to completely terminate a queue, which deletes all pending messages in the queue. To do so, follow these steps:
13.2.2.8. Viewing the properties of a messageTo view the properties of a message, do the following:
13.2.2.9. Deleting all messagesYou might want to clear a queue of messages. To purge all messages in a queue, do the following:
13.2.2.10. Creating routing linksRouting links are used to send messages between separate sites. Messages are routed through these links according to the cost of the link, a numeric identifier indicating the preference of the administrator as to how often a particular routing link is used. The lower the cost, the more often MSMQ will pass traffic over that routing link. Only users in the Enterprise Admins group can create or modify links if there are multiple domains in your organization. To create routing links, follow these steps:
There are a couple of issues to remember when creating routing links:
13.2.2.11. Configuring routing linksSite gates represent individual MSMQ servers that service a routing link between sites. You might have occasion to add or remove servers that take care of a linkperhaps due to administrative maintenance or to decommission a particular machine. To change the servers that coordinate the site link, follow these steps:
You also might need to adjust the cost value you have assigned to a routing link for various reasons. To do so, follow these steps:
13.2.2.12. Creating foreign sitesForeign sites are groups of computers that communicate with MSMQ servers that are apart from the current physical network. Much like Active Directory sites, which you learned about in Chapter 5, MSMQ sites are used to delineate the geographical positions of remote networks. Here's how to create a new foreign site:
Now you need to add foreign computers to the new foreign site. Follow the preceding steps, except in step 4, select New Foreign Computer. In the Name box of the resulting screen, enter the name of the foreign computer, and then select the foreign site to which that machine should belong. Click OK when you've finished the process. 13.2.3. Issues with MSMQ and FirewallsMSMQ has certain requirements when communicating with machines on either side of a firewall. It is recommended that if MSMQ computers that reside externally to your firewall need to access your organization's Active Directory, you should configure a VPN for that communication that uses the point-to-point tunneling protocol (PPTP). VPNs are covered in detail in Chapter 11. If you just need MSMQ traffic to be passed through your firewall without access to Active Directory, remote clients sending messages internally require only TCP port 1801 to be open on your firewall. Computers in this scenario cannot access Active Directory, nor can their messages be routed; hence, the destination computer must be directly reachable on the other side of the firewall. 13.2.4. More ResourcesIf administering MSMQ is a large part of your job, you might want to consult the following resources for more information:
|