Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Automate MSMQ Object Creation

By taking advantage of the functionality of two Microsoft Message Queuing libraries, you can minimize the time it takes to create MSMQ objects during testing or deployment of your messaging application. This article shows how to automatically create MSMQ objects using the Microsoft Message Queue 1.0 Object and the MSMQTriggerObjects 1.0 Type libraries. It starts by giving a brief overview of MSMQ objects and how they are traditionally created, then discusses a technique to automatically create these objects using the two Microsoft libraries.


advertisement


By taking advantage of the functionality of two Microsoft Message Queuing libraries, you can minimize the time it takes to create MSMQ objects during testing or deployment of your messaging application.

INTRODUCTION



Consider the following scenario: you are trying to decide on a courier service for shipping your products.  There are several couriers to choose from and all need to be evaluated before you will make your decision.  As part of the evaluation, you will drop a package off at a designated drop box, at which point it will be picked up and delivered.  The catch is, since you are evaluating the service and not actually paying for it, it is required that you personally pickup the drop box from each of the courier's corporate office, install the drop box and remove it when finished.  This sounds crazy, but it is exactly what you end up doing when testing or deploying applications using Microsoft Message Queuing (MSMQ).

Before applications can take advantage of the features in Microsoft Message Queuing, MSMQ objects need to be manually created.  These objects, queues, triggers and rules are typically created using the tools provided by Microsoft, such as the MSMQ Explorer, which are part of the Message Queuing installation.  However, this can become cumbersome if these objects need to repeatedly created and destroyed during testing of your application.  More importantly, leaving this task up to your users during deployment can often lead to unexpected results.

In this article, I will show how to automatically create MSMQ objects using the Microsoft Message Queue 1.0 Object and the MSMQTriggerObjects 1.0 Type libraries.  I will start by giving a brief overview of MSMQ objects and how they are traditionally created.  Then I will discuss a technique to automatically create these objects using the two Microsoft libraries.  For more detailed information on MSMQ and integration into Visual Basic applications, consider reading Ted Pattison’s article in the May 1999 issue of MSJ, Using Visual Basic to Integrate MSMQ into Your Distributed Applications.

MSMQ BASICS

Sending information using MSMQ is very similar to sending mail using the post office.  When you send a letter, you address it with specific information and place it in a mailbox.  The post office will guarantee the pickup, routing, processing and delivery of your letter.  Once the letter arrives at its destination mailbox, the recipient will read it. The same holds true for MSMQ.

Instead of mailboxes, MSMQ uses Queues as pickup and delivery locations. Messages take the place of letters, which contain the information to be delivered.  To add life to your queues, you can implement Triggers and Rules .  When a message arrives in a queue, it's associated trigger will fire if a predefined set of conditions are satisfied.  Rules, which are bound to triggers, either invoke methods in COM objects or run standalone executables when they are activated.  When this is done, parameters can be passed to the COM component or executable to provide information about the associated trigger or queue.

Installing MSMQ is very simple.  If you are running under Windows NT 4.0, MSMQ is installed as a selection of the NT 4.0 Option Pack installation.  Under Windows 2000, you can install MSMQ (displayed as Message Queuing Services) as an additional component during the operating system setup.  One thing to keep in mind is that Message Queuing Services is not selected by default as a Windows 2000 component.  If you did not select Message Queuing Services when you installed Windows 2000, you will need to do so by click on Add/Remove Windows Components under the Add/Remove Programs in the Windows Control Panel.

Unlike queues, which are inherent to MSMQ, triggers and rules are not automatically available when MSMQ is installed.  You can add this functionality by installing the MSMQ Triggers Service.  The MSMQ Triggers Service installation and documentation may be obtained from the Microsoft Message Queuing website.  After installing, verify that the Triggers Service has started by checking for the trigserv.exe process in the Windows Task Manager.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date