HOWTO: How to Write an MSMQ Trigger Application

ID: Q173325

The information in this article applies to:

SUMMARY

Microsoft Message Queue Server (MSMQ) does not come with "trigger" functionality for queues. A "trigger" is a software component that monitors a queue for a certain condition and performs some action when that condition is met. Currently, trigger functionality must be implemented in the application. The MSMQ software development kit (SDK) provides documentation on how to use notification events to provide asynchronous handling of messages, which is one kind of trigger functionality. However, you can also use Performance Monitor counters to monitor for triggering conditions. This article points you to a sample application that shows you how to write a trigger using a Performance Monitor counter.

MORE INFORMATION

The sample, "MQTrigger," is written in Visual Basic and C++. It uses a timer event to periodically poll a Performance Monitor counter for a message count. The sample application displays a dialog box when the message count in a queue reaches the threshold.

Note that monitoring through counters limits you to the functionality of the counters. For example, counters operate locally only, so MQTrigger will not access the queues on a remote computer. MSMQ Performance Monitor counters are limited to showing 64 queues. Also, the sample does not run under Windows 95 because it relies on the Windows NT Performance Monitor counters.

Triggering on changes other than those that can be measured through a counter will require different implementations.

For more information on asynchronous notification, see the online Help in the MSMQ SDK.

The sample application is located at:

   ftp://ftp.microsoft.com/bussys/distapps/msmq/samples/1.0/mqtrigger.exe

REFERENCES

For more information on Performance Monitor, see the "Optimizing Windows NT" volume of the Windows NT 3.51 Resource Kit.

Additional query words: Perfmon app

Keywords          : kbprg MQProg kbfaq
Version           : WINDOWS NT:1.0
Platform          : winnt
Issue type        : kbhowto

Last Reviewed: January 30, 1998